cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/12/05/01:39:05

Message-ID: <3849FB74.AAC74D31@armenia.multi.net.co>
Date: Sun, 05 Dec 1999 00:43:16 -0500
From: Jorge Ivan Meza Martinez <jimezam AT armenia DOT multi DOT net DOT co>
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>
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 <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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019