Which of the following statements are correct about the program?
#include<stdio.h>
int main()
{
int x = 30, y = 40;
if(x == y)
printf("x is equal to y\n");
else if(x > y)
printf("x is greater than y\n");
else if(x < y)
printf("x is less than y\n")
return 0;
}
The compiler reports an error since main() cannot call itself.
Answer: Option B
Explanation:
Step 1: int i = 0; here variable i is declared as an integer type and initialized to '0'(zero). Step 2: i++; here variable i is increemented by 1(one). Hence, i = 1 Step 3: if(i <= 5) becomes if(1 <= 5) here we are checking '1' is less than or equal to '5'. Hence the if condition is satisfied. Step 4: printf("IndiaBIX\n"); It prints "IndiaBIX" Step 5: exit(); terminates the program execution.