Celsius -> Fahr


/ Published in: C
Save to your folder(s)

This program show two columns of temperature. In left - t of celsius, in right - t. of fahr.


Copy this code and paste it in your HTML
  1. #include <stdio.h>
  2. main()
  3. {
  4. int fahr, celsius;
  5. int lower,upper,step;
  6.  
  7. lower = 0;
  8. upper = 300;
  9. step = 20;
  10.  
  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. }

URL: www.sa1t.ru

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.