fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int rows;
  6. cout<<"Enter number of rows:";
  7. cin>>rows;
  8. cout<<"Pyramid using *:\n";
  9. for(int i=0;i<rows;i++){
  10. for(int j=0;j<=i;j++){
  11. cout<<"* "<<" ";
  12. }
  13. cout<<endl;
  14. }
  15. return 0;
  16. }
Success #stdin #stdout 0.01s 5296KB
stdin
5
stdout
Enter number of rows:Pyramid using *:
*  
*  *  
*  *  *  
*  *  *  *  
*  *  *  *  *