Programming Fundamentals/Variables/C
Appearance
(Redirected from Computer Programming/Variables/C)
variables.c
[edit | edit source]// This program converts a Fahrenheit temperature to Celsius.
//
// References
// https://www.mathsisfun.com/temperature-conversion.html
// https://en.wikibooks.org/wiki/C_Programming
#include <stdio.h>
int main()
{
float fahrenheit;
float celsius;
printf("Enter Fahrenheit temperature: ");
scanf("%f", &fahrenheit);
celsius = (fahrenheit - 32) * 5 / 9;
printf("%f° Fahrenheit is %f° Celsius", fahrenheit, celsius);
return 0;
}
Try It
[edit | edit source]Copy