Commit d7095088 by ilahma

Upload New File

parent 72aa72f8
Showing with 78 additions and 0 deletions
#include <stdio.h>
int main()
{
int d;
int m;
int y;
printf("Please enter day, month and year:\n");
scanf("%d",&d);
scanf("%d",&m);
scanf("%d",&y);
if(d>0 && y>0 && m>0 )
{
if(m<=12)
{
if(m!=2)
{
if(m==9||m==4||m==6|| m==11)
{
if(d<=30)
{
printf("Valid date!\n");
}
}
else
{
if(d<=31)
{
printf("Valid date!\n");
}
}
}
else
{
if(d<29)
{
printf("Valid date!\n");
}
else if(d==29)
{
if(y%4==0)
{
if(y%100==0 && y%400!=0)
{
printf("Invalid date!!!\n");
}
else if(y%100==0 && y%400==0)
{
printf("Valid date!\n");
}
}
else
{
printf("Invalid date!\n");
}
}
else
{
printf("Invalid date!\n");
}
}
}
}
else
{
printf("Invalid date!!!\n");
}
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment