Explore a little.C ProgrammingC++HTMLVisual BasicSystem AnalysisE-CommerceBCA Notes
LEARN SOMETHING NEW

C++ Program to print half pyramid using numbers

Read4BCA learning libraryFree access

C++ Program to print half pyramid using numbers

//C++ Program to print half pyramid using numbers
//header files
#include<iostream.h>
#include<conio.h>

void main()
{

clrscr();
int rows;
cout << "Enter number of rows: ";
cin >> rows;
for(int i = 1; i <= rows; i++)
{

for(int j = 1; j <= i; j++)
{

cout <<j<< " ";

}
cout << "\n";

}
getch();

}

Output

C++ Program to print half pyramid using numbers example

This lesson preserves the original Read4BCA material. Some programming examples use older tools and syntax. View original page.