Each square corresponds to one space include stdioh int mainvoid int x 635

# Each square corresponds to one space include stdioh

This preview shows page 3 - 5 out of 8 pages.

Show the output of the following program in the space provided below it. Each square corresponds to one space #include <stdio.h> int main(void) { int x=-635; double y=34.678; printf("%8.2lf%3d\n",y,x); printf("%11.4lf%6d%4.3lf\n",y,x,y); return 0; } 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 3 4 . 6 8 - 6 3 5 3 4 . 6 7 8 0 - 6 3 5 3 4 . 6 7 8 Question 4: 10 points Consider the following program int main() { double x; printf("enter a value for x >"); scanf("%lf",&x); if(x<85) printf("5"); else if (x<75) printf("1"); else if(x<90) printf("2"); else if( x>85) printf("4"); else printf("3"); return 0; } The above program compiles and runs without errors. Indicate the range of the values of x (entered by the user) for each of the values printed by the program. You have to choose the exact range. a. It cannot be printed   b.  75 c. x < 75 d. 75  x < 85  e. 85   x < 90 f. 75  x < 90 g. x < 85 h.  90 Value printed By the program Range of x values typed by  the user (Choose from  a,b,c,d, e,f, g,h) 1 a 2 e 3 a 4 h 5 g 3
Question 5 (6 points) What is the output of the following program #include <stdio.h> int main() { int x=0,i; for (i=0;i<=4;i=i+3) { switch(i-2) { case 0: case -1: x=x+2; break; case 2: case 1: x=x+1; case 4: case 3: x=x+3; break; default : x+=5; } printf("x=%d\n",x); } printf("i=%d\n",i); return 0; }

#### You've reached the end of your free preview.

Want to read all 8 pages?

• Spring '10
• baleh
• Expression, printf