Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

Header file



Iterative statement



Specifer



Test expression



Comment




Temperature Conversion from Fahrenheit to Celsius to Kelvin and Vice versa



// AHF C PROGRAM SOLVING

//solving here basic type of programming problem

#include<stdio.h> #include<math.h> #define pf printf int main() { float F,C,K,T1,T2,T3,T4,T5,T6,T7,T8,T9; pf("Enter THE FAHRENHEIT temperature: "); scanf("%f",&F); T1=F; pf("The FAHRENHEIT temperature is: %f",T1); T2=(F-32)*5/9; pf("\nThe Celsius temperature is: %f",T2); T3=(F-32)*5/9+273.15; pf("\nThe kelvin temperature is: %f",T3); pf("\nEnter the CELSIUS temperature: "); scanf("%f",&C); T4=(C*9/5)+32; pf("\nThe FAHRENHEIT temperature is: %f",T4); T5=C; pf("\nThe Celsius temperature is: %f",T5); T6=C+273.15; pf("\nThe kelvin temperature is: %f",T6); pf("\nEnter the Kelvin temperature: "); scanf("%f",&K); T7=(K-273.15)*9/5+32; pf("\nThe FAHRENHEIT temperature is: %f",T7); T8=K-273.15; pf("\nThe Celsius temperature is: %f",T8); T9=K; pf("\nThe kelvin temperature is: %f",T9); return 0; }
OUTPUT:


© 2018 - All rights reserved