fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int M;
  6. cin >> M; // liczba wierszy
  7.  
  8. for (int i = 0; i < M; i++) {
  9. // wypisz i spacji
  10. for (int j = 0; j < i; j++) {
  11. cout << " ";
  12. }
  13.  
  14.  
  15. for (int k = 0; k < M; k++) {
  16. cout << "*";
  17. }
  18.  
  19. cout << endl;
  20. }
  21.  
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0.01s 5320KB
stdin
4 5
stdout
****
 ****
  ****
   ****