100% switch program with & without break statement

/*In case '2' ...this is character '2'   and not integer 2

#include <stdio.h>

int main()
{
  int z=4;
  switch(z)
  {
      case 1: printf("\n MahArAShTra is famous for onions");
      case 4: printf("\n shadow of main temple of TanjAvur does not fall on earth");
      case '2': printf("\n 15-8-1947 is friday"); /*as there is no break statement in the above case 4, even this line gets printed on output screen*/
                break;
       case 7: printf("this line wont get printed because in above case '2', a break is encountered and so command will go out of switch") ;
 }
}

ఔట్పుట్  తెర  మీద ఇలా ..
shadow of main temple of TanjAvur does not fall on earth
 15-8-1947 is friday

కామెంట్‌లు

ఈ బ్లాగ్ నుండి ప్రసిద్ధ పోస్ట్‌లు

100% C prog to write content into a file and then read it back onto the console

Spic macay

శ్రీరస్తు.. రామలింగ 18-1-24 (సూరసాని వారి ఆహ్వానము)