1. Celsius to Fahrenheit
2. Fahrenheit to Celsius
#include <stdio.h>
void conversionC(){
int celsius;
printf("Type the degree Celsius (°C) you want to convert: ");
scanf("%d", &celsius);
printf("It is in %d°F\\n", celsius*9/5+32 );
}
void conversionf(){
int fahrenheit;
printf("Type the degree Fahrenheit (°F) you want to convert: ");
scanf("%d", &fahrenheit);
printf("It is in %d°C\\n", fahrenheit-32*9/5);
}
int main (){
int userInput;
printf("What unit conversion are you looking for?\\n");
printf("1: Celsius -> Fahrenheit\\n");
printf("2: Fahrenheit -> Celsius\\n");
scanf("%d", &userInput);
switch (userInput) {
case 1:
conversionC();
break;
case 2:
conversionf();
break;
default:
printf("You didn't choose anything from above\\n");
break;
}
}
Output: