Advertisement
acarrunto

FOR statement

Jul 25th, 2022
1,248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1. // FOR statement
  2. #include <stdio.h>
  3. main(){
  4.     int fahr;
  5.     float rpta;
  6.     for(fahr = 0; fahr <= 300; fahr = fahr + 20){
  7.      //   printf("%3d %6.1f\n", fahr, (5.0/9.0)*(fahr-32));
  8.         rpta = (5.0/9.0)*(fahr-32);
  9.         printf("%3d %6.1f\n", fahr, rpta); // %x.yf -> x = long max del numero, .y = num decimal.
  10.     }
  11.     printf("the end"); // para saber cuando termina.
  12.     return 0;
  13. }
  14.  
  15. // OUTPUT DEL PROGRAMA.
  16.  0  -17.8
  17.  20   -6.7
  18.  40    4.4
  19.  60   15.6
  20.  80   26.7
  21. 100   37.8
  22. 120   48.9
  23. 140   60.0
  24. 160   71.1
  25. 180   82.2
  26. 200   93.3
  27. 220  104.4
  28. 240  115.6
  29. 260  126.7
  30. 280  137.8
  31. 300  148.9
  32. the end
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement