third exercise
This commit is contained in:
parent
4fd0182e6c
commit
43fcdf7034
|
@ -0,0 +1,17 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
int main(){
|
||||||
|
float fahr, celsius;
|
||||||
|
float lower, upper, step;
|
||||||
|
|
||||||
|
lower = 0; /* lower limit of temperature scale */
|
||||||
|
upper = 300; /* upper limit */
|
||||||
|
step = 20; /* step size */
|
||||||
|
|
||||||
|
fahr = lower;
|
||||||
|
printf("celsius fahrenheit\n");
|
||||||
|
while (fahr <= upper) {
|
||||||
|
celsius = (5.0/9.0) * (fahr-32.0);
|
||||||
|
printf("%7.0f %10.1f\n", fahr, celsius);
|
||||||
|
fahr = fahr + step;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue