21 lines
371 B
C
Executable File
21 lines
371 B
C
Executable File
/*
|
|
Exercise 02:
|
|
Implemente a temperature converter.
|
|
It should convert Fahrenheit to Celsius.
|
|
The conversion may be done with this formula: C=(F-32)*5/9
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
float temp_f = 0;
|
|
float temp_c = 0;
|
|
|
|
int main()
|
|
{
|
|
printf("Fahrenheit: ");
|
|
scanf("%f", &temp_f);
|
|
temp_c = (temp_f - 32)*5/9;
|
|
printf("Celsius: %.2f\n", temp_c);
|
|
|
|
return 0;
|
|
} |