error coding a function in c
hi,
This is the code for a function:
#include <stdio.h>
main()
{
float square();
float a, b;
printf("Enter any number\n");
scanf("%f",&a);
b=square(a);
printf(" sqaure of %f is %f\n",a,b);
}
float square(float x)
{
float y;
y=x*x;
return(y);
}
and this is the error of result when run the program:
[root@localhost lbin]# ./l138
Enter any number
2.5
sqaure of 2.500000 is 0.000000
plz tell me where is the mistake.
|