Advertisement
Dido09

C - Celcius to Fahrenheit

Feb 9th, 2022
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. #define STEP 20
  5.  
  6. int main()
  7. {
  8. const int LOWER = 0;
  9. const int UPPER = 300;
  10.  
  11. int cel;
  12. float fahr;
  13.  
  14. printf("Celsius to Fahrenheit Converter\n");
  15. printf("C\tF\n");
  16.  
  17. for(cel = LOWER;cel < UPPER;cel += STEP){
  18. fahr = cel * 9/5 + 32;
  19. printf("%d\t%g\n", cel, fahr);
  20. }
  21.  
  22. return 0;
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement