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
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
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 .
From the condition,
is false.
The output of the program is Aweful.
#SPJ2
Similar questions