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