Question
This is my code: #include #include #include int main(int argc, char **argv) { double boilingPoint = 0; double methane = -161.7; double me1= methane -
This is my code:
#include
int main(int argc, char **argv) { double boilingPoint = 0;
double methane = -161.7; double me1= methane - (methane * 0.05); double me2= methane + (methane * 0.05);
double butane = -0.5; double bu1= butane - (butane * 0.05); double bu2= butane + (butane * 0.05);
double water = 105; double wa1= water - (water * 0.05); double wa2= water + (water * 0.05);
double nonane = 150.8; double no1= nonane - (nonane * 0.05); double no2= nonane + (nonane * 0.05);
double mercury = 357; double mer1= mercury - (mercury * 0.05); double mer2= mercury + (mercury * 0.05);
double copper = 1187; double co1= copper - (copper * 0.05); double co2= copper + (copper * 0.05);
double silver = 2193; double si1= silver - (silver * 0.05); double si2= silver + (silver * 0.05);
double gold = 2660; double go1= gold - (gold * 0.05); double go2= gold + (gold * 0.05);
printf("Enter the temperature: "); scanf("%lf", &boilingPoint);
if((me1 boilingPoint)){ printf("%.0f C is the boiling point of Methane.", boilingPoint); } else if((bu1 boilingPoint)){ printf("%.0f C is the boiling point of Butane.", boilingPoint); } else if((wa1 boilingPoint)){ printf("%.0f C is the boiling point of Water.", boilingPoint); } else if((no1 boilingPoint)){ printf("%.0f C is the boiling point of Nonane.", boilingPoint); } else if((mer1 boilingPoint)){ printf("%.0f C is the boiling point of Mercury.", boilingPoint); } else if((co1 boilingPoint)){ printf("%.0f C is the boiling point of Copper.", boilingPoint); } else if((si1 boilingPoint)){ printf("%.0f C is the boiling point of Silver.", boilingPoint); } else if((go1 boilingPoint)) { printf("%.0f C is the boiling point of Gold.", boilingPoint); } else { printf("%.0f C is the boiling point of unknown substance.",boilingPoint); }
return 0; }
=================================================
What should I do so that the code will print exactly what the user typed in? For example, if the user typed 50 it would print 50 and if the user typed 6.3287 it would print 6.3287.
3. Boiling Point Table 1 shows the normal boiling points of several substances. Write a program that prompts the user for the observed boiling point of a substance in degrees Celsius and identifies the substance if the observed boiling point is within 5% of the expected boiling point. If the data input is more than 5% higher or lower than any of the boiling points in the table, it should output Unknown substance Enter the temperature: 105 105 C is the boiling point of Water. Enter the temperature: 5000 5000 C is the boiling point of unknown substance Substance Boiling lPoint (C) Methane Butane Water Nonane Mercu Copper Silver Gold -161.7 0.5 100 150.8 357 1187 2193 2660 ry Table 1: Expected Boiling PointsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started