rendered paste body#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
void DisplayMenu();
int main() {
char userSelection;
float fTemp, tempDegree;
DisplayMenu();
scanf("%c",&userSelection);
userSelection = toupper(userSelection);
while(userSelection != 'C') {
switch(userSelection) {
case 'A':
printf("Enter the degress in Fahrenheit: ");
scanf("%f",&tempDegree);
fTemp = tempDegree * 1.8f + 32;
printf("%.0f degress Fahrenheit = %.0f degrees Centigrade\
\nPress any key to continue...",fTemp,tempDegree);
getch();
system("cls");
DisplayMenu();
break;
case 'B':
printf("Enter the degress in Centigrade: ");
scanf("%f",&tempDegree);
fTemp = (tempDegree - 32) / 1.8f;
printf("%.0f degress Centigrade = %.0f degrees Fahrenheit\n",fTemp,tempDegree);
getch();
system("cls");
break;
default:
printf("%28s%-30s","Invalid Selection!!\n");
return 1;
}
}
return 0;
}
void DisplayMenu() {
printf("%55","Temperature Conversion Program");
printf("\n\n%28s%-30s"," ","A. Fahrenheit to Centigrade");
printf("\n%28s%-30s"," ","B. Centigrade to Fahrenheit");
printf("\n\n%28s%-14s", " ","Select A/B>");
}