main()
{
int fahr, celsius;
int lower, upper, step;
lower = 300; /* lower limit of temperature scale */
upper = 0; /* upper limit */
step = 20; /* step size */
celsius = lower;
printf("Celsius --> Fahrenheit\n");
while (celsius >= upper)
{
fahr = (9.0/5.0) * celsius + 32.0;
if (celsius == 0) printf("%d\t\t%d\n",1, fahr);
else printf("%d\t\t%d\n",celsius, fahr);
celsius = celsius - step;
}
}
*******************OR******************************************
#include
main()
{
int fahr,celsius;
int lower,upper, step;
lower=0;
upper=300;
step=20;
fahr=upper;
while(fahr>=lower)
{
celsius=5*(fahr-32)/9;
printf("%d\t%d\n",fahr,celsius);
fahr=fahr-step;
}
}