Commit 88c691af by emonyi

Upload New File

parent 2ed4b1e4
Showing with 28 additions and 0 deletions
#include <stdio.h>
int main () {
int dd, mm, yy;
printf("Please enter the date dd/mm/yy:\n");
scanf("%d/%d/%d", &dd, &mm, &yy);
int bissextile = yy % 400 == 0 || (yy % 4 == 0 && yy % 100 != 0);
if (dd>31 || dd<1 || mm>12 || mm<1)
printf("Invalid date.\n");
if((mm==2 && dd<30 && bissextile) || (mm==2 && dd<29 && bissextile==0))
printf("valid date.\n");
else
if((mm==4 || mm==6 || mm==9 || mm==11)&& dd<31)
printf("valid date.\n");
else
if(dd<31 && mm!=2)
printf("valid 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