Contact Learn C
Copy

Program 123:Convert Fahrenheit to Celsius

Program 123:
 
#include<stdio.h>
main()
{ 
 float fahrenheit,celsius;
 printf("Enter Fahrenheit to convert to celsius\n");
 scanf("%f",&fahrenheit);
 celsius=(float)((fahrenheit-32)/1.8);

 printf("%.2f fahrenheit in celsius is %.2f\n",fahrenheit,celsius);
}

Explanation:

  1. This program starts with initializing :
    • fahrenheit → To store input
    • Celcius → To store output of program
  2. printf("Enter Fahrenheit to convert to celsius\n");
     scanf("%f",&fahrenheit);
    Taking input from user
  3.  celsius=(float)((fahrenheit-32)/1.8);
    Formula for calculating celcius and finally we print it.

 Output:

Convert Fahrenheit to Celsius



















Donate

Download App and Learn when ever you want

Get it on PlayStore
Get it on Amazon App Store
Get it on Aptoide