Write an application to convert the entered temperature C in Celsius to Fahrenheit. The conversion formula between Celsius temperature and Fahrenheit temperature is: F=1.8*C+32 How can I do it?

1 Answers

+7Votes

#include

int main()

{

float F,C;

printf (“Please input cels: “);

scanf (“%f”,&C);

F=C*1.8+32.0;

printf (“The fahr is: %.2f”,F);//Keep two decimal places

return 0;

}

here I use float (single-precision data), which can keep decimals and make calculations more accurate

+7

Votes#include

int main()

{

float F,C;

printf (“Please input cels: “);

scanf (“%f”,&C);

F=C*1.8+32.0;

printf (“The fahr is: %.2f”,F);//Keep two decimal places

return 0;

}

here I use float (single-precision data), which can keep decimals and make calculations more accurate

Kimberly- November 25, 2020 |