im trying to write a temp conv. program from fahr to cel. by using a function , it works but im trying to make it print a number after the decimal and it gets all messed up...
Code:
#include <stdio.h>
#define NEXTSTEP 20
int convertingfunction(int, int);
int main(void)
{
int c;
int i;
for(c = 0; c <= 300; c = c + 20)
printf("%d %3d\n", c, convertingfunction(c,i));
return 0;
}
int convertingfunction(int whzzup, int hehehe)
{
int d;
int c;
d = 0;
d = (5.0/9.0) * (whzzup-32);
return d;
}
this works all right but how do u get it to print numbers after the decimal? i tried changing d into a float as well as c but they all come out messed up.