Saturday 4 August 2012

Case structure002

Input the number of day and print the day of week.


#include <stdio.h>
#include <conio.h>
void main ( )
{
        int         day;
        clrscr ( );
        
        printf ("\n Enter the number of day in the week (1-7):"); scanf ("%d",&day);
        
        switch ( day )
        {                                         
                  case 1:
                          printf ("\n MONDAY");
                          break;
                  case 2:
                          printf ("\n TUESDAY");
                          break;
                  case 3:
                          printf ("\n WEDNESDAY");
                          break;
                  case 4:
                          printf ("\n THURSDAY");
                          break;
                  case 5:
                          printf ("\n FRIDAY");
                          break;
                  case 6:
                          printf ("\n SATERDAY");
                          break;
                  case 7:
                          printf ("\n SUNDAY");
                          break;
                  default:
                          printf ("\n Wrong input.");
        }
        getch ( );
}


Click here to contact us

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...