Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Sep 5th, 2010 | Syntax: None | Size: 0.46 KB | Hits: 24 | Expires: Never
Copy text to clipboard
  1. #include <stdio.h>
  2. /* print Fahrenheit-Celsius table
  3. for fahr = 0, 20, ..., 300 */
  4. main()
  5. {
  6. {
  7. printf("fahrenheit to celsius\n");
  8. }
  9. int fahr, celsius;
  10. int lower, upper, step;
  11. lower = 31;
  12. upper = 120;
  13. step = 5;
  14. /* lower limit of temperature scale */
  15. /* upper limit */
  16. /* step size */
  17. fahr = lower;
  18. while (fahr <= upper) {
  19. celsius = 5 * (fahr-32) / 9;
  20. printf("%d\t%d\n", fahr, celsius);
  21. fahr = fahr + step;
  22. }{
  23. printf("fahrenheit to celsius\n");
  24. }
  25.  
  26. }