Programming in "C‟ | Write a „C‟ program to enter any number between 1 to 7 and display its corresponding week day using switch case statement.

#include<stdio.h>

main()

{

int n;

clrscr();

printf("enter any number between 1 to 7 :");

scanf("%d",&n);

switch(n)

{

case 1:

 printf("Monday");

 break;

case 2:

 printf("Tuesday");

 break;

case 3: 

 printf("Wednesday");

 break;

case 4:

 printf("Thursday");

 break;

case 5:

 printf("Friday");

 break;

case 6:

 printf("Saturday");

 break;

case 7:

 printf("Sunday");

 break;

default:

 printf("Invalid number");

}

getch();

Post a Comment

0 Comments