Advertisement
wingman007

FahrenheitCelsiusC

May 6th, 2018
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. #include <stdio.h>
  2. /* print Fahrenheit-Celsius table
  3. for fahr = 0, 20, ..., 300 */
  4. main()
  5. {
  6.     int fahr, celsius;
  7.     int lower, upper, step;
  8.     lower = 0; /* lower limit of temperature scale */
  9.     upper = 300; /* upper limit */
  10.     step = 20; /* step size */
  11.     fahr = lower;
  12.     while (fahr <= upper) {
  13.         celsius = 5 * (fahr-32) / 9;
  14.         printf("%d\t%d\n", fahr, celsius);
  15.         fahr = fahr + step;
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement