This is a slightly more difficult problem. Alter your program from question 2 so that it deals with months as well as years, and produces output such as the following:
Enter the current year then press RETURN.
1996
Enter the current month (a number from 1 to 12).
10
Enter your current age in years.
36
Enter the month in which you were born (a number from 1 to 12).
5
Enter the year for which you wish to know your age.
2001
Enter the month in this year.
6
Your age in 6/2001: 41 years and 1 month.
The program should cope with singulars and plurals properly in the output, e.g. "1 month" but "2 months".
This is my program but i will leave a blank there because i don really know how to show the output for 1 month and 2 months
#include<stdio.h>
main()
{
int a,b,c,d,i,x,y,z,month,total;
printf("Enter current year then press RETURN : ");
scanf("%d",&x);
printf("Enter the current month (a number from 1 to 12) : ");
scanf("%d",&a);
printf("Enter your current age in years : ");
scanf("%d",&y);
printf("Enter the month in which you were born (a number from 1 to 12) : ");
scanf("%d",&b);
printf("Enter the year for which you wish to know your age : ");
scanf("%d",&z);
printf("Enter the month in this year : ");
scanf("%d",&c);
i=z-x;
total=i+y;
???????? <== here
???????
printf("Your age in %d/%d : %d years and %d month",c,z,total,month);
return 0;
}
And please tell me the way to make this programe as simple( i mean short)