Site Loader
Get a Quote

print star pattern in c++

print star patterns in c++: –These program prints various different patterns of numbers and stars. This program will print triangle star patterns using c++ program. A pattern of numbers, star or characters is a way of arranging these in some logical manner or they may form a sequence.

code to prints star pattern in c++

Here we have written a program in c++ to generate print star pattern.we have used header file on the top of the program then used the namespace after that we have taken input from the console to display.we have used for loop to print star pattern in the form of traingle shape

#include<iostream>

#include<conio.h>

using namespace std;




int main()

{

            int i,j,k;

            for(i=1;i<=5;i++)

            {

                        for(j=5;j>i;j--)

                                    cout<<' ';

                        for(k=1;k<2*i;k++)

                                    cout<<'*';

                        cout<<endl;

            }




            getch();

            return 0;

}

OUTPUT

print star pattern

Post Author: TechieFlair

Leave a Reply

Your email address will not be published.