Previous: 2.7 Summary
Up: 2 Basic Concepts
Next: 2.9 Problems
Previous Page: 2.7 Summary
Next Page: 2.9 Problems
Given the following variables and their initializations:
int a, x, y, z;
float b, u, v, w;
x = 10; y= 20; z = 30;
u = 4.0; v = 10.0;
What are the values of the expressions in each of the following problems:
(a) a = x - y - z; (b) a = x + y * z; (c) a = z / y + y; (d) a = x / y / z; (e) a = x % y % z
(a) a = (int) (u / v); (b) a = (int) (v / u); (c) b = v - u; (d) b = v / u / w;
(a) 5 % 3 (b) -5 % 3 (c) 5 % -3 (d) -5 % -3
(a) (x <= y && x >= z) (b) (x <= y || x >= z) (c) (x <= y && !(x >= z)) (d) (x = y && z > y) (e) (x == y && z > y)
(a) (x = y && y = z) (b) (x == y && y == z) (c) (x == y || y == z) (d) (x >= y && x <= z) (e) (x > y && x < z)
(a)
main()
{ int n;
scanf("%d", n);
}
(b)
main()
{ float n;
printf("%d", n);
}
(c)
main()
{ int n1, n2;
if (n1 = n2)
printf("Equal\n");
else
printf("Not equal\n");
}
main()
{ int n, count;
scanf("%d", &n);
while (count < 10) {
printf("%d\n", n);
scanf("%d", &n);
}
}
i = 1;
while (i < 10) {
printf("%d\n", i);
i = i + 1;
}
if (late_days == 1)
fine = 0.10;
else
fine = late_days * 0.15;