17 lines
321 B
C
17 lines
321 B
C
|
|
#include <stdio.h>
|
||
|
|
|
||
|
|
//A program for converting from C to F, using a function!
|
||
|
|
float convCelsius(int fh){
|
||
|
|
return ((fh) - 32) * (5.0 / 9.0);
|
||
|
|
}
|
||
|
|
|
||
|
|
int main(){
|
||
|
|
printf("%6s, %6s\n", "DEG F", "DEG C");
|
||
|
|
for(int cFH = -200; cFH <= 400; cFH = (cFH + 10)){
|
||
|
|
printf("%6.0d | %6.2f\n", cFH, convCelsius(cFH));
|
||
|
|
}
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
|