Have a Read!

Hi Everyone.
The idea for this page is to provide new c users simple c tutorials to learn how to develop the logic and more importantly correct way to write syntax.
ENJOY !!!

Thursday, January 27, 2011

C PROGRAM FOR SWITCH CONTROL

#include<stdio.h>
int main ()
{
int day;
printf("ENTER THE WEEKDAY\n");
scanf("%d",&day);
switch(day)
{
  case 1: printf("weekday is Sunday\n");
          break;
  case 2: printf("weekday si Monday\n");
      break;
  case 3: printf("weekday is Tuesday\n");
      break;
  case 4: printf("weekday is Wednesday\n");
      break;
  case 5: printf("weekday is Thursday\n");
      break;
  case 6: printf("weekday is Friday\n");
         break;
  case 7: printf("weekday is Saturday\n");
       break;
  default:printf("Wrong choice entered\n");
      break;
}
return 0;
}

No comments:

Post a Comment

Related Posts with Thumbnails