fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main() {
  6. int x = 5;
  7. cout << string(x, '*') << '\n';
  8. for(int i = x-2; i >= 1; i--) {
  9. cout << string(i, ' ') << "*\n";
  10. }
  11. cout << string(x, '*') << '\n';
  12.  
  13. return 0;
  14. }
Success #stdin #stdout 0s 3228KB
stdin
Standard input is empty
stdout
*****
   *
  *
 *
*****