C Program to Convert Celsius to Fahrenheit

In this tutorial, i am going to show you how to convert celsius to Fahrenheit in c program.

Algorithm to Convert Celsius to Fahrenheit

Follow the below given algorithm to write a program to convert Celsius to Fahrenheit; as follows:

  • Start program.
  • Take an input celsius and store into a variable.
  • Convert to celsius to fahrenheit.
  • Print fahrenheit.
  • Stop program.

C Program to Convert Celsius to Fahrenheit

#include <stdio.h>
 
int main()
{
    float celsius, fahrenheit;
 
    printf("Please Enter temperature in Celsius: :- ");
    scanf("%f", &celsius);
 
    // Convert the temperature from celsius to fahrenheit 
    fahrenheit = ((celsius * 9)/5) + 32;
    // fahrenheit = ((9/5) * celsius) + 32;
    // fahrenheit = ((1.8 * celsius) + 32;
 
    printf("\n %.2f Celsius = %.2f Fahrenheit", celsius, fahrenheit);
 
    return 0;
}

The result of the above c program; as follows:

Please Enter temperature in Celsius: :- 100
100.00 Celsius = 212.00 Fahrenheit

More C Programming Tutorials

Be First to Comment

Leave a Reply

Your email address will not be published.