Home C C++ Java Python Perl PHP SQL JavaScript Linux Online Test Forum

Home » Forum » x-Forum » Question

switch case statement

Using  switch case statement

write a program that will output the corresponding day according to the number given (1-7)

example
   1-Monday



thanks in advance :)

Posted by xzzjyn 2018-09-12 06:34:47

#include<stdio.h>

int main()
{
int day;
printf("
 Enter Day no : ");
scanf("%d", &day);

switch(day)
{
case 1: printf("Monday"); break;
case 2: printf("Tuesday"); break;
case 3: printf("Wednesday"); break;
case 4: printf("Thurs"); break;
case 5: printf("Fri"); break;
case 6: printf("Sat"); break;
case 7: printf("Sun")break;
default: printf("invalid input");
}

return 0;

}

C++ user image Admin posted 2018-09-12 07:30:14

Your Answer


Ask New Question