Computer Science, asked by anjum4030, 4 months ago

7. What will be the output of the following program?
int main()
{
float i = 10.1;
if(++i < 11.1)
printf("Awesome");
else
printf("Aweful");
return 0;
}​

Answers

Answered by Anonymous
6

Answer:

The output will be Awful.

Explanation:

while using unary increment operator (++i) the variable i increases by 1 and thus becomes => 11.1  . . . . . . . . . (10.1 + 1 = 11.1)

checking the condition (++i < 11.1)

=> it turns out to be false.

hence, the command jumps to the else statement and print Awful.

hope i helped :)

Answered by mahimapanday53
0

Concept:

The test expression inside the parentheses is evaluated by the if statement ().

If the test expression returns true, the statements in the if body are performed.

If the test expression returns false, the statements in the else body are performed.

Find:

The output of the program.

Solution:

With the increment, the value of i is 11.1.

From the condition,

11.1 &lt; 11.1 is false.

The output of the program is Aweful.

#SPJ2

Similar questions