Code for week according to number

Code for week according to number


#include<stdio.h>
#include<conio.h>
void main()
{
int d;
printf("Enter any number from 1 to 7");
scanf("%d",&d);
if(d==1)
{
printf("Sunday");
}
else if(d==2)
{
printf("Monday");
}
else if(d==3)
{
printf("Tuesday");
}
else if(d==4)
{
printf("Wednesday");
}
else if(d==5)
{
printf("Thursday");
}
else if(d==6)
{
printf("Friday");
}
else if(d==7)
{
printf("Saturday");
}
else
{
printf("Enter a valid number");
}
getch();
}


Output



Comments

Popular posts from this blog

Code for pattern 6

Code to check leap year