Mail Archives: djgpp/1999/12/05/01:39:05
Look carefuly to your code ...
> float ftc(n)
> int n;
> {
> float c, f; int i;
> for (i=0;i<=n;i++){
> c=5/9*(f-32);
> }
> return c;
> }
> c=5/9*(f-32);
^
when you give a value to f ?
is garbage now.
jimezam.
> Jason Yip wrote:
>
> Can anyone tells me why the value of "c" is always equal to zero??
> How can I correct this?
> Thanks a lot!!
>
> #include <stdio.h>
> float ftc(n)
> int n;
> {
> float c, f; int i;
> for (i=0;i<=n;i++){
> c=5/9*(f-32);
> }
> return c;
> }
> main ()
> {
> float c, f=0; int i=0;
> do
> {
> c=ftc(i);
> printf("\t\t F=%.2f \t\t C=%.2f\n",f,c);
> f++;
> i++;
> } while (i<=100);
> }
- Raw text -