-
Which of the following statements are correct about the program given below?
#include <stdio.h>
int main ()
{
float k = 0.7;
if (k < 0.7)
printf ("C\n");
else
printf ("C++\n");
return 0 ;
}
-
- The program will output C
- The program will output C++
- Compiler will report an error saying a float cannot be compared with a double.
- Output will be C for 16-bit compilers and C++ for 32-bit compilers
Correct Option: A
if(k < 0.7) here k is a float variable and 0.7 is a double constant. The float variable k is less than double constant 0.7. Hence the if condition is satisfied and it prints 'C'