Monday 24 October 2016

Program : WAP to read a number between 1 to 7 and print day of the week using Switch statement.



/********************************************************
* Pogram to read a number  between 1 to 7 and print day*
#include<stdio.h>
#include<conio.h>
void main()
{
  int integer_number;
  clrscr();
  printf("\nEnter A Integer Number:");
  scanf("%d",&integer_number);
  switch(integer_number)
   {
     case 1:
                printf("\nThe Day Is Monday");
                break;
     case 2:
                printf("\nThe Day Is Tuesday");
                break;
     case 3:
                printf("\nThe Day Is Wednesday");
                break;
     case 4:
                printf("\nThe Day Is Thursday");
                break;
     case 5:
                printf("\nThe Day Is Friday");
                break;
     case 6:
                printf("\nThe Day Is Saturday");
                break;
     case 7:
                printf("\nThe Day Is Sunday");
                break;
     default:
                printf("\nSorry,Wrong Input,Please Input The Number 1 to 7 ");
                break;
 }
getch();
}

Output:

No comments:
Write comments