fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int limit;
  7. cin >> limit;
  8.  
  9. for (int i = 1; i <= limit; i++) {
  10. for (int j = 1; j <= limit - i; j++) {
  11. cout << " ";
  12. }
  13.  
  14. for (int j = 1; j <= i; j++) {
  15. cout << "O";
  16. }
  17.  
  18. cout << "\n";
  19. }
  20. }
Success #stdin #stdout 0s 5320KB
stdin
6
stdout
          O
        OO
      OOO
    OOOO
  OOOOO
OOOOOO