C++ program to print following trianlge using character *

C++ program to print following trianlge using character *

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

void main()
{
clrscr(); //to clear the screen
int i,j,k,n;

cout<<“How many lines?”;
cin>>n;

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

1 thought on “C++ program to print following trianlge using character *”

Leave a Comment

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