WRITE A PROGRAM THAT CONVERT TEMPERATURE FROM CENTIGRADE TO FAHRENHEIT.
#include<stdio.h> // Header file “Standard Input and Output”
#include<conio.h> //Header file “Console input and output”
void main ()
{
clrscr(); // Clear the output screen
float temperature; //
Variable declaration
printf("Enter
the temperature in centigrade = ");
scanf("%f",
&temperature);
temperature
= (9*temperature)/5 + 32; // Formula:
9/5 * temperature + 32
printf("\nThe
temperature in Fahrenheit is = %f",temperature);
getch();
}
OUTPUT
Enter the
temperature in centigrade = 32
The temperature
is Fahrenheit is = 89.6
Enter the
temperature in centigrade = 100
The temperature
is Fahrenheit is = 212
EXPLANATION
Simple conversion
formula is used in this program. The exact formula is written in the comments.
No comments:
Post a Comment