Unit convertor in C program with source code

Unit convertor in C program with source code


Unit convertor is a c programming based project. It converts one single unit into different units. Unit convertor is easy to use.

This project is coded in C programming language. This project is good for learning and understanding c programming. C and C++ are like same but they have some common differences. The program is useful for converting temperature units. Such as Celsius, Fahrenheit, kelvin, Reaumur, and Rankine. This program uses temperature conversion formulae for converting the units. Reaumur is used for measuring the temperature during cheese production, sugar syrup cooking etc.

Rankine is used for measuring thermodynamic temperatures. This program asks you to input the unit in degree Celsius and it will be automatically converted in other units. This program uses simple logic for calculations. You need to compile and execute the program to see how the program works. It has command-line interface. You can try juni website for learning c program in an easy and fun way. You must download program C based code editor. Such as DevC++, Turbo C, Vs code, etc.

See the source code and output below.


//unit convertor

#include <stdio.h>
int main()
    float celsius, fahrenheit, kelvin, rankine, reaumur;
    printf("Enter temperature in Celsius: ");
    scanf("%f", &celsius);

    fahrenheit = (celsius * 9 / 5) + 32;
    kelvin = (celsius + 273.15);
    rankine = (celsius + 273.15) * 1.8;
    reaumur = (celsius * 0.8);
    printf("%.2f Celsius = %.2f Fahrenheit", celsius, fahrenheit);
    printf("%.2f Celsius = %.2f Kelvin", celsius, kelvin);
    printf("%.2f Celsius = %.2f Rankine", celsius, rankine);
    printf("%.2f Celsius = %.2f Reaumur", celsius, reaumur);
    return 0;

unit convertor

How to use this unit convertor project?

  • Download the software Dev C++ or any other. 
  • Copy and paste the code above. 
  • Compile and execute the code.
  • Convert the degree in various units.
  • Enjoy and share.