Page 1 of 1

Complete the following unit conversion program with reference to the sample output. Hint: #include int main()

Posted: Fri May 20, 2022 10:12 am
by answerhappygod
Complete
the following unit conversion program with reference to the sample
output.
Hint:
#include <stdio.h>
int main()
{
char category;
int tempChoice;
int userinputF; // User inputted Fahreinheit;
int userinputUSDtoEuro; // User inputted for USD to
EURO;
int userinputOunce; // User inputted for Ounce;
int fahrenheitToCelcius; // variable that stores the
converted F->C;
float USDtoEURO ; // variable that stores the converted
USD->EURO;
float ounceToPounds; // stores the converted
Ounce->Pounds;
printf("Welcome to Unit Converter! \n");
scanf("%c",&category); // this code reads in user
input from keyboard
if(category == 'T'){
scanf("%d",&tempChoice);
if(tempChoice == 1){
printf("Please enter the Fahrenheit degree: \n");
scanf("%d",&userinputF);
fahrenheitToCelcius = ((userinputF-32) * (5.0/9.0));
printf("Celcius: %d",fahrenheitToCelcius);
}
else if(tempChoice == 2){
}
else
printf("Please enter
the correct choice. \n");
}
else if(category == 'C')
{
// implement your code here
}
else if(category == 'M')
{
// implement your code here
}
return 0;
}