C++ program to print the following design:

C++ program to print the following design:

#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=1;j<i;j+=2)
cout<<” “;
for(k=n-1;k>i;–k)
cout<<“*”;
}
getch(); //to stop the screen
}

Leave a Comment

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