Week number and print weekday with C language
#include <stdio.h>
int main()
{
int dayNum;
printf("Enter dayNum number (1-7): ");
scanf("%d", &dayNum);
if (dayNum == 1)
{
printf("Monday");
}
else if (dayNum == 2)
{
printf("Tuesday");
}
else if (dayNum == 3)
{
printf("Wednesday");
}
else if (dayNum == 4)
{
printf("Thursday");
}
else if (dayNum == 5)
{
printf("Friday");
}
else if (dayNum == 6)
{
printf("Saturday");
}
else if (dayNum == 7)
{
printf("Sunday");
}
else
{
printf("Please enter Valid dayNum number between 1-7.");
}
return 0;
}
Output:-
Enter dayNum number(1 - 7) : 5
Friday
0 Comments