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

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

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

Post 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;
}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply