Message-ID: <3849FB74.AAC74D31@armenia.multi.net.co> Date: Sun, 05 Dec 1999 00:43:16 -0500 From: Jorge Ivan Meza Martinez X-Mailer: Mozilla 4.61 [en] (Win98; I) X-Accept-Language: es-CO,en MIME-Version: 1.0 To: djgpp AT delorie DOT com, manman AT netteens DOT net Subject: Re: Why "c" is always zero?? References: <82cko6$sfk$1 AT imsp026 DOT netvigator DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com 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 > 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); > }