Please Give me Full solution In this Full Question Code segment 1 a) int x, y; 1. 2. x=10; 3. y=-2; 4. if(x) { 5. printf
Posted: Fri Apr 29, 2022 7:00 am
Please Give me Full solution In this Full Question Code segment 1 a) int x, y; 1. 2. x=10; 3. y=-2; 4. if(x) { 5. printf(“This is the first if block”); 6. } 7. if(y){ 8. printf(“This is the second if block”); 9. } 10. printf("\n%d\n", x++); 11. printf("%d\n", --y); 12. printf("%d %d\n", x, y); 1) (1) What will be the output of this given code segment? 2) Why did you get this output? Explain each line of statement of the code segment. Code segment 2 Output 1: b) * **** ***** *** 1. 2. 3. 4. 5. 6. 7. int i; for(i = 0; i <8; i++) { if(i==0 || i==7) printf("******\n"); else printf(“* *\n"); // 4 spaces are given } 幸 Will the code segment 2 produce similar output as the output 1? Explain your answer. (5)