Q:

C Program To Print Day of Week Name Using Switch Case

0

Problem:- C program to print day of week name using switch case or Display Day Name according to the Day Number using Switch Case or C Program to Print Days of Week in Words using Switch Case Statement or Program in C to Display day of week using switch case or Days of week using switch case or C program to input number of week's day(1-7) and translate to its equivalent name of the day of the week or Simple C Program for Switch case to Find weekdays name or print Days of Week using switch-case or program to print days of week using switch.

 

Explanation:- In this problem, we have to find the day, let's take an input as an example suppose user enter 5(User input should be between 1 to 7 ) than out program will print the message on screen " Today Is Friday ", and for other input it will print the appropriate message on screen. If user think he is smart and he is trying to enter some other than values 1 to 7 then program will print the message " Don't be Smart Wrong Choice Try Again!!!". program will work only if values are 1 to 7.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include<stdio.h>
 
main()
{
 /*Visit - www.programmingwithbasis.com*/
 int choice;
 
 printf("Monday Willbe First Days and So On\n\n");
 printf("Enter Any Number Between (1 to 7):");
 
 scanf("%d",&choice);
 printf("\n");
 
 switch(choice)
 {
 case  1:
 printf("Today is Monday");
 break;
 case  2:
 printf("Today is Tuesday");
 break;
 case  3:
 printf("Today is Wednesday");
 break;
 case  4:
 printf("Today is Thursday");
 break;
 case  5:
 printf("Today is Friday");
 break;
 case  6:
 printf("Today is Saturday");
 break;
 case  7:
 printf("Today is Sunday");
 break;
 default:
 printf("Don't Be Smart....Wrong Choice Try Again!!!");
 }
 getch();
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now