Examveda

What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
    float f1 = 0.5;
    double f2 = 0.5;
    if (f1 == 0.5f)
        cout << "equal";
    else
        cout << "not equal";
    return 0;
}

A. equal

B. not equal

C. compile time error

D. runtime error

Answer: Option A


Join The Discussion

Related Questions on Variables and Data Types in C plus plus