smeacham

Temperature Conversion

Nov 6th, 2012
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.31 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5.   float fahr, celsius;
  6.   int lower, upper, step;
  7.  
  8.   lower = 0;
  9.   upper = 300;
  10.   step = 20;
  11.  
  12.   fahr = lower;
  13.   while(fahr <= upper)
  14.   {
  15.     celsius = (5.0 / 9.0) * (fahr - 32.0);
  16.     printf("%3.0f %6.1f\n", fahr, celsius);
  17.     fahr = fahr + step;
  18.   }
  19.   return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment