Monday, February 8, 2021

Program to print Half Pyramid using number using C++

Print Half Pyramid using number Using C++


#include<iostream.h>
#include<conio.h>
int main()
{
  int rows;
  cout<<"Enter the number of rows : ";
  cin>>rows;
  for(int i=1;i<=i;++j)
  {
    for(int j=1;j<=i;++j)
    {
      cout<<j<<" ";
    }
    cout<<"\n";
  }
  getch();
}


Output :


Enter the number the rows
3

1
1 2
1 2 3

No comments:

Post a Comment