Dido09

For Loop Syntax - C

Mar 14th, 2022 (edited)
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. // Print numbers from 1 to 10
  2. #include <stdio.h>
  3.  
  4. int main() {
  5. int i;
  6.  
  7. for (i = 1; i < 11; ++i)
  8. {
  9. printf("%d ", i);
  10. }
  11. return 0;
  12. }
  13. //////////////////////////////////////////////////////
  14. #include <stdio.h>
  15.  
  16. int main() {
  17. int num = 10;
  18.  
  19. for (int x = 0, y = num; x < y; x++, y--) {
  20. printf("%d\n %d\n", x, y);
  21. }
  22. }
Add Comment
Please, Sign In to add comment