Contact Learn C
Copy

Program 122:Program to Convert Celsius to Fahrenheit

Program 122:
 
#include<stdio.h>
main()
{ 
 float fahrenheit,celsius;
 printf("Enter celsius to convert to fahrenheit\n");
 scanf("%f",&celsius);
 
 fahrenheit=(float)((celsius)*(1.8)+(32));
 printf("%.2f degree in farenheit is %.2f\n",celsius,fahrenheit);
}

Explanation:

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

 Output:

Convert Celsius to Fahrenheit



















Donate

Download App and Learn when ever you want

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