
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

void main (void) { float c,f,k; int ch; clrscr(); printf ("\n\n\nWelcome to the temperature converter\n\n\n"); printf ("Please choose one of the temperature conversions you want\n"); printf ("\n\nIf you want to convert temperature from:\n\n\t\tCentigrades to Farenheit and Kelvin please enter 1\n"); printf ("\n\t\tFarenheit to Centigrades please enter 2\n"); printf ("\n\t\tKelvin to Centigrades please enter 3\n"); printf ("\n\nEnter the choice:"); scanf ("%d",&ch); switch (ch) { case 1: { printf ("\n\tPlease enter the temperature in Centigrades:"); scanf ("%f",&c); k = c-273; f = (c+32)9/5; printf ("\n\n\tThe temperature in Kelvin is: %f\n",k); printf ("\n\n\tThe temperature in Farenheit is: %f\n",f); break; } case 2: { printf ("\n\tPlease enter the temperature in Farenheit:"); scanf ("%f",&f); c = (f-32)5/9; printf ("\n\n\tThe temperature in Centigrades is: %f\n",c); break; } case 3: { printf ("\n\tPlease enter the temperature in Kelvin:"); scanf ("%f",&k); c = k+273; printf ("\n\n\tThe temperature in Centigrades is: %f\n",c); break; }} getch(); }