Find the value of “a” in each of the following statements:
int i=3 , j=4 ,k=8
float a=4.5 ,b=6.5,c=3.5

Last Updated on by ICT BYTE

  1. Find the value of “a” in each of the following statements:
    int i=3 , j=4 ,k=8
    float a=4.5 ,b=6.5,c=3.5
    (a) a = b- i/k +c/k
    (b) a = (b-k)/j + (j + c)/k
    (c) a = c-(( i + j)/(k + i))*b
    (d) a = c – i + j / k+ i * b
    (e) a = c + j % 2 +b
    (f) a = (b + 1) % (c + 1).

Let’s calculate the value of “a” for each of the given statements:

(a) a = b – i/k + c/k
Substituting the given values:
a = 6.5 – 3 / 8 + 3.5
a = 6.5 – 0.375 + 3.5
a = 6.125 + 3.5
a = 9.625

(b) a = (b – k) / j + (j + c) / k
Substituting the given values:
a = (6.5 – 8) / 4 + (4 + 3.5) / 8
a = (-1.5) / 4 + 7.5 / 8
a = -0.375 + 0.9375
a = 0.5625

(c) a = c – ((i + j) / (k + i)) * b
Substituting the given values:
a = 3.5 – ((3 + 4) / (8 + 3)) * 6.5
a = 3.5 – (7 / 11) * 6.5
a = 3.5 – 0.6364 * 6.5
a = 3.5 – 4.1364
a = -0.6364

(d) a = c – i + j / k + i * b
Substituting the given values:
a = 3.5 – 3 + 4 / 8 + 3 * 6.5
a = 3.5 – 3 + 0.5 + 19.5
a = 0.5 + 19.5
a = 20

(e) a = c + j % 2 + b
Substituting the given values:
a = 3.5 + 4 % 2 + 6.5
a = 3.5 + 0 + 6.5
a = 10

(f) a = (b + 1) % (c + 1)
Substituting the given values:
a = (6.5 + 1) % (3.5 + 1)
a = 7.5 % 4.5
a = 3

So, the values of “a” in each of the given statements are:
(a) a = 9.625
(b) a = 0.5625
(c) a = -0.6364
(d) a = 20
(e) a = 10
(f) a = 3

More From Author

B.Sc. Entrance Model Question with Answer | Mathematics

Write a program for the interest charged in installments for the following case. A cassette player costs Rs. 2000. A shopkeeper sells it for Rs. 100 down payment and Rs. 100 for 21 more months. What is the monthly interest charged?