# C Program to Convert Temperature

In this C programming example we will learn how to convert temperature from Celsius to Fahrenheit degrees.

Before write the program first we need to know the relation between Celsius and Fahrenheit.

The Mathematical formula is

 Fahrenheit=Celsius +32

So now based on this formula we will write c program to convert temperature

In this Example we will Convert between given user input values start and end and the step number to increment the count.

take Celsius value which we need to take from user input and highest value upto which we need to convert

 ```#include  #define LOWER_LIMIT 0 #define HIGHER_LIMIT 1000 int main(void) {     double fahr, cel;     int limit_low = -1;     int limit_high = -1;     int step = -1;     int max_step_size = 0;          /* Read in lower, higher limit and step */     while(limit_low < (int) LOWER_LIMIT) {         printf("Please enter a lower limit, limit >= %d: ", (int) LOWER_LIMIT);         scanf("%d", &limit_low);     }     while((limit_high <= limit_low) || (limit_high > (int) HIGHER_LIMIT)) {         printf("Please enter a higher limit, %d < limit <= %d: ", limit_low, (int) HIGHER_LIMIT);         scanf("%d", &limit_high);     }     max_step_size = limit_high - limit_low;     while((step <= 0) || (step > max_step_size)) {         printf("Please enter a increment step, 0 < step >= %d: ", max_step_size);         scanf("%d", &step);     }          /* Initialise Celsius-Variable */     cel = limit_low;          /* Print the Table */     printf("\nCelsius\t\tFahrenheit");     printf("\n-------\t\t----------\n");     while(cel <= limit_high) {         fahr = (9.0 * cel) / 5.0 + 32.0;         printf("%f\t%f\n", cel, fahr);         cel += step;     }     printf("\n");          return 0; } ```

Output

 Please enter a lower limit, limit >= 0: 50 Please enter a higher limit, 50 < limit <= 1000: 1000 Please enter a increment step, 0 < step >= 950: 100 Celsius        Fahrenheit -------        ---------- 50.000000    122.000000 150.000000    302.000000 250.000000    482.000000 350.000000    662.000000 450.000000    842.000000 550.000000    1022.000000 650.000000    1202.000000 750.000000    1382.000000 850.000000    1562.000000 950.000000    1742.000000

Conclusion: In this C program we learned how to convert temperature from Celsius to Fahrenheit