Note: At First, Solve this Programme Without Using Computer. Then run it in your Computer to Check your Answer.
(a) when x is given as 1, 5, 0 respectively ? #include <stdio.h> int main() { int x; scanf(“%d”,&x); switch(x!=5){ case 0: printf(“A”); break; case 1: printf(“B”); break; case 2: printf(“B”); break; default: printf(“C”); } return 0; }
b) #include <stdio.h> int main() { int x=5; switch(x!=0) { case 0: printf(“Red”); break; case 1: printf(“Green”); default: printf(“Blue”); break; }
download file in here
ReplyDelete