1 1 vote Output of the following program? #include <stdio.h> char input[ ] = "SSSWILTECH1\1\11W\1WALLMP1"; main() { int i,c; for( i=2 ; ( c=input[i] ) ! = '\0' ; i++) { switch(c) { case 'a' : putchar( 'i' );continue; case '1' : break; case 1 : while( ( c=input[++i] )!= '\1' && c!= '\0' ); case 9 : putchar( 'S' ); case 'E' : case 'L' : continue; default : putchar (c); continue; } putchar( ' ' ); } putchar( '\n' ); } Programming in C switch-case programming-in-c + – V Y 1.2k views answer comment Share Follow Print See 1 comment 1 1 comment reply V Y commented Jun 29, 2017 reply Follow flag Answer given-- SWITCH SWAMP . 1 1 replyShare Please log in or register to add a comment.
Best answer 1 1 vote #include <stdio.h> char input[ ] = "SSSWILTECH1\1\11W\1WALLMP1"; int main(void) { int i,c; for(i=2;(c=input[i])!='\0';i++){//Printing starts at a[2] switch(c) { case 'a' : putchar( 'i' );continue; case '1' : break; case 1 : while( ( c=input[++i] )!= '\1' && c!= '\0' ); case 9 : putchar( 'S' ); case 'E' : case 'L' : continue; default : putchar (c); continue; } putchar( ' ' ); } putchar( '\n' ); return 0; } Printing starts at a[2]=S, and case S is by default print S. 'L' and 'E' executes continue statements. srestha answered Jun 29, 2017 • selected Jun 30, 2017 by V Y srestha comment Share Follow See 1 comment 1 1 comment reply Shubhanshu commented Jun 30, 2017 reply Follow flag After reading first '1' it will break and come out of the switch statement and then execute putchar(' '); ryt? But what will happen when at '\' ? 0 0 replyShare Please log in or register to add a comment.