Advertisement
0xCor3

nested loop three

Nov 24th, 2019
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.23 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. main()
  6. {
  7.     int a, b;
  8.    
  9.     for (a=7; a >= 1; a--){
  10.         for (b=a; b >= 1; b--){
  11.             cout << (a-b) + 1;
  12.         }
  13.        
  14.         cout << "\n";
  15.     }
  16. }
  17.  
  18. /**
  19. 1234567
  20. 123456
  21. 12345
  22. 1234
  23. 123
  24. 12
  25. 1
  26. **/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement