Kiran Borge

Mar 15, 2026 • 1 min read

C++ Pattern Programs

C++ All patterns

*
***
****
*****
#include <iostream>
using namespace std;

int main()
{
 int num = 5;

 for(int i=1; i<=5; i++)
 {
 for(int j=1; j<=i; j++)
 {
 cout << "* ";
 }
 cout << "\n";
 }
 return 0;
}
*****
****
***
**
*
#include <iostream>
using namespace std;

int main()
{
 int num = 5;

 for(int i=1; i<=5; i++)
 {
 for(int j=5; j>=i; j--)
 {
 cout << "* ";
 }
 cout << "\n";
 }
 return 0;
}
 *
 **
 ***
 ****
 *****
#include <iostream>
using namespace std;

int main()
{
 int num = 5;

 for(int i=1; i<=5; i++)
 {
 for(int j=i; j<5;j++)
 {
 cout << " ";
 }
 for(int k=1; k<=i; k++)
 {
 cout << "*";
 }
 cout << "\n";
 }
 return 0;
}
 *****
 ****
 ***
 **
 *
#include <iostream>
using namespace std;

int main()
{
 int num = 5;

 for(int i=1; i<=5; i++)
 {
 for(int j=1; j<i;j++)
 {
 cout << " ";
 }
 for(int k=i; k<=5; k++)
 {
 cout << "*";
 }
 cout << "\n";
 }
 return 0;
}
 * 
 * *
 * * * 
 * * * *
 * * * * * 
#include <iostream>
using namespace std;

int main()
{
 int num = 5;

 for(int i=1; i<=5; i++)
 {
 for(int j=i; j<5;j++)
 {
 cout << " ";
 }
 for(int k=1; k<=i; k++)
 {
 cout << "* ";
 }
 cout << "\n";
 }
 return 0;
}
 * 
 * * *
* * * * *
#include <iostream>
using namespace std;

int main()
{
 int num;
 cout << "Enter Number: ";
 cin >> num;

 for(int i=1; i<=num; i++)
 {
 for(int j=i; j<num; j++)
 {
 cout << " ";
 }
 for(int k=1; k<=2*i-1; k++)
 {
 cout <<"* ";
 }
 cout <<"\n";
 }
 return 0;
}

Join Kiran on Peerlist!

Join amazing folks like Kiran and thousands of other builders on Peerlist.

peerlist.io/

It’s available... this username is available! 😃

Claim your username before it's too late!

This username is already taken, you’re a little late.😐

0

0

0