i am designing a code that will calculate tomorrows date but there is some problem with the code,
when i enter
year = 2008 or anyother
month =12
day = 31
it gives tmorrows date as 1/2/2008
please help and tell me if i can do more improvements thanks
#include<conio.h>
#include<stdio.h>
main(void)
{
int t;
int y,d=1,i,m=1;
printf("Enter the Year: ");
scanf("%4u",&y);
if(y<0)
y=-y;
printf("Enter the Month: ");
scanf("%2u",&m);
if(m<=0 || m>=12)
m=1;
i=y%4;
printf("Enter the Day: ");
scanf("%2u",&d);
if (d>=1&&d<28)
d=d+1;
else if(d==i&&m==2)
{d=1;
m=3;}
else if (d==30&&m==4||m==6||m==9||m==11)
{d=1;
m=m+1;}
else if (d==31&&m==1||m==2||m==3||m==5||m==7||m==8||m==10)
{
d=1;
m=m+1;
}
else if(d==31&&m==12)
{
d=1;
m=1;
y=y+1;
}
printf("Tomorrow's Date is\n %d/%d/%d ",d,m,y);
getch();
}