fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(void)
  6. {
  7. int n;
  8. cin >> n;
  9.  
  10. for (int i = 1; i <= n; i++)
  11. {
  12. for (int j = 0; j < n - i; j++)
  13. cout << " ";
  14.  
  15. for (int j = 0; j < n - (n - i); j++)
  16. cout << "*";
  17.  
  18. cout << endl;
  19. }
  20. return 0;
  21. }
Success #stdin #stdout 0s 4960KB
stdin
5
stdout
    *
   **
  ***
 ****
*****