No, it's not! :laugh:
It's just that cout defaults to an "unformatted double" which removes trailing zeros after the decimal point.
If you change your code to this:
while(t--){
double n=0.2;
cout<<n*3.00<<"\n";
}
It will print "0.6"
t
times.
You can also use
fixed
to "force" decimal places:
cout<< fixed <<n*3.00<<"\n";
Which will give you "6.000000"
Or you could combine it with setting the precision to give you two decimal digits:
int main()
{
cout<<"Hello World";
int t;
cin>>t;
cout.precision(2);
while(t--){
double n=2.00;
cout<< fixed <<n*3.00<<"\n";
}
return 0;
}