output of below program?
#include <stdio.h>
void main()
{
int i = 1;
if (i++ && (i == 1))
printf("Hi");
else
printf("Hello");
}
a
Answers
Answered by
3
Answer:
The given program outputs the word Hello.
Explanation:
The value of the variable 'i' is 1.
In the first ''if'' statement, the program checks whether i++ and i ==1 are the same. But, they are not the same. i is 1, but i++ is not 1, it is some other number.
So, as the if statement is false, the program checks the 'else' statement. And in the else statement, it says to print("Hello"). Therefore, the output is Hello.
Similar questions