Turn Desktop View Off
by Dinesh Thakur

This is C program that ask user to check the day in week that is been selected. For this user need to declare the variables for this and the user also uses the switch statement for choice base condition to chose the day in a week. As user declare simple switch statement each case statement for every day after declaring the case statement user ask to put a number the number will be from 1-7 otherwise it will be an invalid number. default case shows the message invalid number if the number out of case that user select.

Problem statement:
This is C Program that asks user to find out the days in a week.

  1. Declare variables.
  2. Using switch statement.
  3. Display result on the screen.

Here is C source code for check the day in a week. Output of this program shown below. 

#include<stdio.h>

#include<conio.h>
void main()
{
       int a;
       clrscr();
       printf("Enter a no. :");
       scanf("%d",&a);
       switch(a)
         {                                       
                 case 1:printf("Monday");break;
                 case 2:printf("Tuesday");break;
                 case 3:printf("Wednesday");break;
                 case 4:printf("Thrusday");break;
                 case 5:printf("Friday");break;
                 case 6:printf("Saturday");break;
                 case 7:printf("Sunday");break;
                 default : printf("Invalid no.");
          }
                 getch();
}
Output:

Check the Day in Week