fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() { int n ;
  5. cin >> n ;
  6. for ( int i = 1 ; i <= n ; i++){
  7. int spaces = i ;
  8. if ( i > n/2 ) spaces = n-i-1 ;
  9. for (int j = 0 ; j < spaces ; j++) cout <<" " ;
  10. for ( int j = 0 ; j < n-2*spaces ; j++) cout << "o" ;
  11. cout << endl ;
  12. }
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22. }
Success #stdin #stdout 0s 5320KB
stdin
5
stdout
 ooo
  o
 ooo
ooooo
ooooooo