oh nice...#include <math.h> did the trick
Zainny, why do I have to use ??
Code:
int main() {
/* code here */
return 0;
}
even if it works without int and return 0; ?
Do i need it there so later on i could call that program from another program? Even though i would not do that but is that the logic behind it?
and here is the final program:
Code:
#include <stdio.h>
#include <math.h>
int main(){
char digit[5];
char reversdigit[5];
int i;
double s;
double s2;
int num;
int reversnum;
printf("Please enter a 4 integer : ");
scanf("%s",digit);
printf("The number is %s.\n",digit);
num= atoi(digit);
s = sqrt((double)num);
printf("The square root of %s is: %6.4f \n", digit, s);
for(i=0;i<4;i++){
reversdigit[i] = digit[3-i];
}
reversdigit[4] = '\0';
printf("The number in reverse is %s.\n",reversdigit);
reversnum= atoi(reversdigit);
s2 = sqrt((double)reversnum);;
printf("The square root of %s is: %6.4f \n", reversdigit, s2);
return 0;
}
thanks again