Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
#include
3.
using namespace std;
4.
int main()
5.
{
6.
cout
Options:
A .  0.11
B .  0.10000000000000001
C .  0.100001
D .  compile time error
Answer: Option B

The double had to truncate the approximation due to it’s limited memory, which resulted in a number 

that is not exactly 0.1.
Output:
$ g++ float2.out
$ a.out
0.10000000000000001



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers