i'm extremely new user of c++ , know why calculations producing extremely absurd results. part of code having problems with.
printf("please enter length of side:\n"); scanf("%.f", &lengthcube); volume=lengthcube*lengthcube*lengthcube; printf("the volume of cube %.f", volume);
volume
, lengthcube
have been both defined float
values. test value of 10 in gives answer of -13798...(a very long number). on issue appreciated. thanks!
you using wrong format scanf
, printf
- should "%f"
, not "%.f"
.
Comments
Post a Comment