{}
See how a CS professor is using our compiler for class assignment.
Try Programiz PRO for Educators!
Learn DSA with step-by-step code visualization.
Try Programiz PRO for Educators!
run-icon
main.c
#include <stdio.h> int main() { int choice; float temp,res; printf("temprature converter:\n"); printf("1.celsius to fahrenheit\n"); printf("2.celsius to kelvin\n"); printf("3.fahrenheit to celsius\n"); printf("4.fahrenheit to kelvin\n"); printf("5.kelvin to fahrenheit\n"); printf("6.kelvin to cesius\n\n"); printf("enter your choice(1-6):"); scanf("%d",&choice); switch(choice){ case 1: printf("enter the temprature in celsius:"); scanf("%f",&temp); res=(temp*9/5)+32; printf("Fahrenheit:%.2f\n",res); break; case 2: printf("enter the temperature in celsius"); scanf("%f",&temp); res=temp+273.15; printf("kelvin:%.2f\n",res); break; case 3: printf("enter the temprature in faherenheit:"); scanf("%f",&temp); res=(temp-32)*5/9; printf("fahrenheit:%.2f\n",res); break; case 4: printf("enter the temprature in fahrenhiet:"); scanf("%f",&temp); res=(temp-32)*5/9+273.15; printf("fahrenheit:%.2f\n",res); break; case 5: printf("enter the temprature in kelvin:"); scanf("%f",&temp); res=temp-273.15; printf("kelvin:%.2f\n",res); break; case 6: printf("enter the temprature in kelvin:"); scanf("%f",&temp); res=(temp-273.15)*9/5+32; printf("kelvin:%.2f\n",res); break; } return 0; }
Output