Please Use C programming knowledge to do this and follow the instructions in the
ID: 3773571 • Letter: P
Question
Please Use C programming knowledge to do this and follow the instructions in the question. :)
2. Write a program that requests the user to enter a Fahrenheit temperature. The
program should read the temperature as a type double number and pass it as an
argument to a user-supplied function called Temperatures(). This function should
calculate the Celsius equivalent and the Kelvin equivalent and display all three
temperatures with a precision of two places to the right of the decimal. It should
identify each value with the temperature scale it represents. Here is the formula
for converting Fahrenheit to Celsius:
Celsius = 1.8 * Fahrenheit + 32.0
The Kelvin scale, commonly used in science, is a scale in which 0 represents
absolute zero, the lower limit to possible temperatures. Here is the formula for
converting Celsius to Kelvin:
Kelvin = Celsius + 273.16
The Temperatures() function should use const to create symbolic
representations of the three constants that appear in the conversions. The main()
function should use a loop to allow the user to enter temperatures repeatedly,
stopping when a q or other nonnumeric value is entered.
Explanation / Answer
#include <stdio.h>
void temp(double);
int main(void)
{
double fahrenheit_temp;
printf("Enter a fahrenheit temperature: ");
scanf("%lf", &fahrenheit_temp);
printf(" ");
temp(fahrenheit_temp);
return 0;
}
void temp(double f)
{
float c;
float k;
c = 1.8 * f + 32;
k = c + 273.16;
printf("Fahrenheit Celcius Kelvin ");
printf("%.2f %.2f %.2f ", f, c, k);
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.