C++ Program to print following triangle:

 *
**
***
****
*****

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

void main()
{
clrscr();
int n,i,j;
cout<<“Ener size of Triangle(ex-4):”;
cin>>n;
cout<<“nt”;

for(i=0;i<n;++i)
{
for(j=0;j<=i;++j)
cout<<“*”;
cout<<“nt”;
}
getch();
}

Leave a Comment

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