Solution for Exercise 10-11
ex1011
#include <stdio.h> float convert(float f); int main() { float temp_f; printf("Temperature in Fahrenheit: "); scanf("%f",&temp_f); printf("%.1fF is %.1fC\n",temp_f,convert(temp_f)); return(0); } float convert(float f) { return(f - 32) / 1.8; }
Notes
* You could put the entire equation from Line 17 in parentheses:
* Parentheses are optional in a return
statement, required only if the evaluation needs them. I always use parentheses in my code, mostly from habit.
Copyright © 1997-2024 by QPBC.
All rights reserved