190k views
5 votes
Assume a program has the following variable defenition: int a, b =2; float c = 4.2; and the following statement: a = b * c; What will be stored in a? A. 8.4 B. 8 C. 0 D. None of the above

1 Answer

3 votes

Answer:

The correct option is B.

Explanation:

In a program the variables are defined as

int a, b =2;

float c = 4.2;

The given statement is

a = b * c

a = 2 * 4.2

a = 8.4

It is given that variable a is an integer. So, only integer value can be stored in a.

a ≈ 8

It means 8 will be stored in a. Therefore the correct option is B.

User Rumen Jekov
by
8.8k points

Related questions

asked Aug 1, 2024 109k views
Arzar asked Aug 1, 2024
by Arzar
7.6k points
1 answer
3 votes
109k views
asked Jun 27, 2024 82.1k views
Crizzwald asked Jun 27, 2024
by Crizzwald
8.4k points
1 answer
2 votes
82.1k views