Wednesday, 16 May 2012

Switch case operation in c

Todaye we have parcticed on switch case operation in c.
here is the code block:

#include <stdio.h>

main()
{
   char option;
  printf("Write your option(Y/N): ");
    scanf("%c",&option);
 switch(option)
 {
    case 'Y':
         printf("Yes, we have a class on friday\n");
         break;
    case 'N':
        printf("No, we don't have any class on friday\n");
        break;
    default:
         printf("write the correct option\n");
         break;
   }
system("PAUSE");
return 0;
}



No comments:

Post a Comment