1.

Which of the following statements are correct about the program given below?
#include <stdio.h>
int main ( )
{
float x = 2.8, y = 2.88;
if (x = y)
printf ("x and y are equal n");
else
printf ("x and y are not equal n");
return 0;
}

A. The output of the program would be "x and y are equal".
B. The statement if (x = y) would report a compilation error.
C. Floats cannot be compared using if.
D. should be used to compare
E. Conditional operates should be used to compare floats.
Answer» B. The statement if (x = y) would report a compilation error.


Discussion

No Comment Found

Related MCQs