Question
1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
float f1 = 0.5;
6.
double f2 = 0.5;
7.
if (f1 == 0.5f)
8.
cout
What is the output of this program?
1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
float f1 = 0.5;
6.
double f2 = 0.5;
7.
if (f1 == 0.5f)
8.
cout
Answer: Option A
Was this answer helpful ?
0.5f results in 0.5 to be stored in floating point representations.
Output:
$ g++ float.cpp
$ a.out
equal
Was this answer helpful ?
Submit Solution