+ 1
I have a homework and I need help
Write a program that converts integer Fahrenheit temperatures from 0 to 212 degrees to floating point Celsius temperatures with 3 digits of precision. perform the calculation using the formula ;(celsius = 5.0/9.0 * (fahrenheit - 32
2 Answers
+ 3
I won't do your homework for you but I will list the steps the program should take...
- Ask for input from user (if the homework task asks you to)
- Store the Fahrenheit or Celsius value in a variable
- Do the calculation
- Print it out like.. printf("%f.3", yourVar);
+ 3
/* Try it Now using SoloLearn Codeplayground!!! */
#include <stdio.h>
int main()
{
int fahrenheit;
float celsius;
for(fahrenheit = 0; fahrenheit <= 212; fahrenheit++)
{
celsius = (fahrenheit - 32) * 5.0 / 9.0;
printf(" \n %3d Fahrenheit = %.3f Celsius", fahrenheit, celsius);
}
return 0;
}