Exercise 2-4 of the title set of "C Language Programming (3rd Edition)" of Zhejiang University Edition

Exercise 2-4 Temperature Conversion (5 points)

This question requires writing a program to calculate the Celsius temperature corresponding to a Fahrenheit temperature of 150°F. Calculation formula: C=5×(F−32)/9, where C represents temperature in Celsius, F represents temperature in Fahrenheit, and the output data is required to be an integer.
Input format:
There is no input for this question.
Output format: output
according to the following format
fahr = 150, celsius = the integer value of the calculated Celsius temperature
Author
Yan Hui
Unit
Zhejiang University City College

Code length limit
16 KB
time limit
400 ms
memory limit
64 MB

#include <stdio.h>

int main() {
    
    
    printf("fahr = 150, celsius = %d",5*(150-32)/9);
    return 0;
}

Guess you like

Origin blog.csdn.net/DoMoreSpeakLess/article/details/109249149