Advertisement
Tahamina_Taha

Conversion of temperature

Jul 10th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.48 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3. int main(void)
  4.  
  5. {
  6.     float celsius,fahrenheit;
  7.  
  8.     printf("Enter temperature in Celsius = ");
  9.     scanf("%f",&celsius);
  10.     fahrenheit=((celsius*9/5)+32); //c to f= (c*5/9+32)
  11.     printf("Temperature in Fahrenheit= %.0f F\n",fahrenheit);
  12.  
  13.     printf("Enter temperature in fahrenheit = ");
  14.     scanf("%f",&fahrenheit);
  15.     celsius=((fahrenheit-32)*5/9); // F to C =(F-32)*5/9
  16.     printf("Temperature in celsius =%.2f C\n",celsius);
  17.  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement