Sunday, 7 August 2016

NESTED SWITCH STATEMENT

#include <stdio.h>
int main ()
{
 int a = 100;
 int b = 200;
 switch(a)
 {
 case 100:
  printf("This is outer part of switch\n");
  printf("Exact value of a is : %d\n", a );
  switch(b)
  {
  case 200:
   printf("This is inner part of switch\n");
   printf("Exact value of b is : %d\n", b );
  }
 }
 return 0;
}

output :
This is outer part of switch
Exact value of a is : 100
This is inner part of switch
Exact value of b is : 200

No comments:

Post a Comment

smhjifrivly@gmail.com