#include <stdio.h>
int main(void)
{
int month, year;
int agemonth, ageyear;
printf(“This program determines the exact age of a person this month given the person’s birthday.\n”);
printf(“\n”);
printf(” 1.January 4.April 7.July 10.October\n”);
printf(” 2.February 5.May 8.August 11.November\n”);
printf(” 3.March 6.June 9.September 12.December\n”);
printf(“\n”);
printf(“\n”);
printf(“\nPlease enter the number of your birthmonth (ie.1 for January):”);
scanf(“%i”,&month);
printf(“\nPlease enter the year of your birth (ie.1998):”);
scanf(“%i”,&year);
if (year<0)
{
printf(“\nINVALID YEAR!!”);
}
else
{
if ((month<=0) || (month>12))
{
printf(“\nINVALID MONTH!!”);
}
else
{
if ((month <= 8) && (month > 0))
{
agemonth = 8 – month;
ageyear = 2010 – year;
printf(“\n1Your age is %i years and %i months.”, ageyear, agemonth);
}
else
{
agemonth = (12 – month) + 8;
ageyear = 2009 – year;
printf(“\n2Your age is %i years and %i months.”, ageyear, agemonth);
}
}
}
return 0;
}