This article will teach you how to Print Full Pyramid Pattern of Numbers in C++.
How to Print Full Pyramid Pattern of Numbers in C++ language.
Desired Output for Size 5:
1
121
12321
1234321
123454321
#include <iostream>
using namespace std;
int main()
{
int num, a;
cout<<"Please enter the number of rows: ";
cin>>num;
for(int r=1; r<=n; r++)
{
for(int c=1; c<=n-r; c++)
cout<<" ";
for(int k=1;k<=(2*r-1);k++)
{
if(k<r)
cout<<k;
else if(k==r)
{
cout<<k;
a=k;
}
else
cout<<--a;
}
cout<<"\n";
}
return 0;
}
Output
- C++ Program to print alphabets triangle from A to E
- C++ Program to print diamond pattern
- C++ Program to print triangle pattern
- Program to print pi pattern in C++
- Simple Pattern Program in C++
- Character Pattern using ASCII value in C++
- Diagonal pattern using Numbers in C++
- Upper Case Character Pattern in C++ using ASCII
- Upper lower Case Mix Character Pattern in C++