Non riesco a capire dove sbaglio.
Codice: Seleziona tutto
#include<stdio.h>
#include<stdlib.h>
int main (void)
{
/* Variables. */
int lower, upper, step;
float fah, cel;
/* Set initials conditions values. */
lower = 0;
upper = 300;
step = 20;
fah = 0.;
cel = 0.;
while (lower <= upper)
{
cel=celsius(fah);
printf("%3.0f\t%6.1f\n",fah,cel);
fah = fah + (1.*step);
lower = lower + step;
}
exit(0);
}
float celsius (float fahreneit)
{
float answer;
answer = (5.0/9.0)*(fahreneit-32);
return answer;
}
=================
0 1.0
20 1.0
40 1.0
60 1.0
80 1.0
100 1.0
120 1.0
140 1.0
160 1.0
180 1.0
200 1.0
220 1.0
240 1.0
260 1.0
280 1.0
300 1.0
Perché il risultato è sempre 1.0?
Grazie per il supporto,
Emanuele.