hi again every1, can any1 please help me with this one? thanks.. ^.^
..i made a c program that should output the square root of a number....
Code:
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
double x=100;
clrscr();
printf("Square root of 100 is equals to: %lf", sqrt(x));
getchar();
return 0;
}
...but every time it does, in this example, it shows 10.000000 (..which is the square root of 100..)
what i want is to make the program output 10 (..with no decimals..) instead of 10.000000...
...another program i made that uses the pow() function:
Code:
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
double x=10;
clrscr();
printf("10 raised to 2 is equals to: %lf", pow(x, 2));
getchar();
return 0;
}
...also has the same problem, it shows 100.000000 instead of just 100
....about the float and double data-type, is it correct that the %lf parameter in the printf() function is for double, and %f for float? im just confused... thanks again for your help and advise... ^.^
...and uhmmm btw, about the title for this post i made, if you found it inappropriate, please, accept my apologies...