C Program to Convert Temperature From Celsius to Fahrenheit and Vice versa || C Programming Tutorial

 C Program to Convert Temperature From Celsius to Fahrenheit and Vice versa 


This is C Program to Convert Temperature From Celsius to Fahrenheit and Vice versa || C Programming Tutorial. We will convert the temperature from Celsius to Fahrenheit and Vice versa . This is C Program to Convert Temperature from Fahrenheit to Celsius and vice versa. this C Program to convert Celsius to kelvin and vice versa and Fahrenheit to kelvin and vice versa. This is the first video of this kind on Youtube to have this program.
Source Code :
/* This is code for all units temperature conversions.
  celsius ----->> fahrenheit , kelvin 
  fahrenheit ----->> celsius , kelvin 
  kelvin ----->> celsius , fahrenheit */

#include<stdio.h>
#include<conio.h>
int main(){
    int choice;
    float c,f,k;
    printf("celsius ----->> fahrenheit , kelvin : press 1 \n");
    printf("fahrenheit ----->> celsius , kelvin : press 2 \n");
    printf("kelvin ----->> celsius , fahrenheit : press 3 \n");
    scanf("%d",&choice);
    switch (choice)
    {
    case 1:
       printf("enter temperature value in celsius : ");
       scanf("%f",&c);
        f = (c*1.8)+32;
        k = c + 273.15;
        printf("%.2f celsius ------>> %.2f fahrenheit , %.2f kelvin ",c,f,k);
        break;

    case 2:
    printf("enter temperature in fahrenheit : ");
    scanf("%f",&f);
    c = ( f32 )/1.8;
    k = (f-32)*5/9 + 273.15;
    printf("%.2f fahrenheit ------>> %.2f celsius , %.2f kelvin ",f,c,k);
    break;

    case 3:
    printf("enter temperature in kelvin : ");
    scanf("%f",&k);
    c = k - 273.15;
    f= (k-273.15)*1.8 + 32;
    printf("%.2f kelvin ------>> %.2f celsius , %.2f fahrenheit ",k,c,f);
    break;

    
    default:
    printf("pls enter valid choice ...");
        break;
    }
    
    return 0;
Previous
Next Post »