C Program to convert Celcius to Fahrenheit

In this program, we will learn how to convert a temperature in Celcius to Fahrenheit. The standard formula to do so is:

Fahrenheit = (Celsius * 9/5) + 32


Fahrenheit = (Celsius * 1.8) + 32


#include <stdio.h>

int main()
    float temp, fTemp;
    printf("Enter the temperature in Celcius: ");
    scanf("%f", &temp);
    fTemp = (temp * 9/5) + 32;
    printf("The equivalent temperature in Fahrenheit is %.1f degrees Fahrenheit", fTemp);

    return 0;


  • The key of this program is the formula by which we convert the temperature from Celcius to Fahrenheit
  • We have declared two variables named temp, and fTemp for Celcius and Fahrenheit temperatures respectively.
  • Then we displayed a message that asks the user to enter a temperature in Celcius.
  • Using the scaf function, we are storing the user input value in the temp variable. Note that we have used the float type here as the temperature could be in decimal format.
  • Now, with the standard formula, we convert the temperature stored in ‘temp’ (Celcius) and store the result in ‘fTemp’(Fahrenheit).
  • Lastly, we display the result to the user using the printf function.