C++ program to print the following pattern:

C++ program to print the following pattern:

#include<iostream.h>
#include<conio.h>

void main()
{
clrscr(); //to clear the screen
int i,j,k,n;
cout<<“How many lines?”;
cin>>n;
n*=2;

for(i=0;i<n;i+=2)
{
cout<<“n”;
for(j=n;j>i;j-=2)
cout<<” “;
for(k=0;k<=i;++k)
cout<<“*”;
}
getch(); //to stop the screen
}

1 thought on “C++ program to print the following pattern:”

  1. it is a really good help to me . one thing i had not found that i am not able to get required answers and program .
    actually i egarly require a program to print the following pattern :- * *
    * *
    * *
    **********
    * *
    * *
    * *

    I have tryed to make a capital ‘ H ‘ if you can provide me with the program to print this it will be a great help.
    i am waithing for your reply plz done it as soon as possible.
    thank you.

Leave a Comment

Your email address will not be published. Required fields are marked *