In my desire to finally completely work through K&R I decided to start at the beginning. The fruit of today’s labor:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #include <stdio.h> main(){ int fahr, celcius; int lower, upper, step; lower = 0; upper = 300; step = 20; fahr = lower; while (fahr <= upper){ celcius = (fahr - 32) / 1.8; printf("%d\t%d\n", fahr, celcius); fahr = fahr + step; } } |
A very simple bit of C without a lot of depth of fancy hackery that converts the temps in Fahrenheit starting at 0 to 300 degrees in intervals of 20 to Celsius.
~ End Article and Begin Conversation ~
There are no comments yet...
~ Now It's Your Turn ~