#include<stdio.h>
void main()
{
float n,a;
while(scanf("%f%f",&n,&a)==2)
{
printf("%f",n*a);
}
}
When I give n=100.00 , a=43.12 as input it
then gives 4311.999893 as results
When I give n=100.00 , a=43.123 as input it
then gives 4312.300110 as results
So I am not getting the actual result.
But How can I get it?
New Problem arrised in c++
Moderator: Board moderators
New Problem arrised in c++
Mr. Arithmetic logic Unit
Re: New Problem arrised in c++
floats don't have the necessary precision required to solve problems. Use doubles instead...TISARKER wrote:So I am not getting the actual result.
But How can I get it?
Ciao!!!
Claudio
Re: New Problem arrised in c++
Ok.
But Ihis problem is arrised in 147(dollars)problem too.
Are u sure by changing float to double without adding 0.5
problem 147(dollars) will be accepted?But I get wong answer.
But Ihis problem is arrised in 147(dollars)problem too.
Are u sure by changing float to double without adding 0.5
problem 147(dollars) will be accepted?But I get wong answer.
Mr. Arithmetic logic Unit