thx mats
but i thought i need to get the program to check whether the input before for the year is leap or not
then decide whether feb is 28 or 29 days
Code:
//Create by z3252440
#include <stdio.h>
int main()
{
int year, month;
enum months{January = 1, February, March, April, May, June, July,
August, September, October, November, December};
printf("Enter year and month:");
scanf("%d %d", &year, &month);
if (((year%4==0 )&& (year%100!=0)) || ((year%400==0) && (year%100==0)&&
(year%4==0)))
{
printf("has three hundred and sixty six (366) days\n");
}
else
{
printf("has three hundred and sixty five (365) days\n");
}
switch(month)
{
case January:
printf("January has 31 days\n");
break;
if (((year%4==0 )&& (year%100!=0)) || ((year%400==0) && (year%100==0)&&
(year%4==0)))
case February:
printf("February has 28 days\n");
else
printf("February has 29 days\n");
break;
}
return 0;
}
As can seen above shouldnt the program check the year then decide which statement to print?
cause this is where i am getting really confuse