PPS Assingment
PPS Assingment
Output
(a) x = ( y + 3 ) ;
(b) cir = 2 * 3.141593 * r ;
(c) char = ‘3’ ;
(d) 4 / 3 * 3.14 * r * r * r = vol_of_sphere ;
(e) volume = a3 ;
(f) area = 1 / 2 * base * height ;
(g) si = p * r * n / 100 ;
(h) area of circle = 3.14 * r * r ;
(i) peri_of_tri = a + b + c ;
(j) slope = ( y2 - y1 ) ÷ ( x2 - x1 ) ;
(k) 3 = b = 4 = a ;
(l) count = count + 1 ;
(m) char ch = '25 Apr 12' ;
[B] Evaluate the following expressions and show their hierarchy.
(a) ans = 5 * b * b * x - 3 * a * y * y - 8 * b * b * x + 10 * a * y ;
(a = 3, b = 2, x = 5, y = 4 assume ans to be an int)
(b) res = 4 * a * y / c - a * y / c ;
(a = 4, y = 1, c = 3, assume res to be an int)
(c) s = c + a * y * y / b ;
(a = 2.2, b = 0.0, c = 4.1, y = 3.0, assume s to be a float)
(d) R = x * x + 2 * x + 1 / 2 * x * x + x + 1 ;
(x = 3.5, assume R to be a float)
[C] Indicate the order in which the following expressions would be
evaluated:
Chapter 2: C Instructions 35
(a) g = 10 / 5 /2 / 1 ;
(b) b = 3 / 2 + 5 * 4 / 3 ;
(c) a = b = c = 3 + 4 ;
(d) x = 2 - 3 + 5 * 2 / 8 % 3 ;
(e) z = 5 % 3 / 8 * 3 + 4
(f) y = z = -3 % -8 / 2 + 7 ;
d=a/2;
printf ( "%d\n", d ) ;
return 0 ;
}