WAP To Print Triangle Pattern Series.
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
void main()
{ int i;space,n,k=0;
clrscr();
cout<<"Enter the no. of rows:";
cin>>n;
for(i=1;i<=n;i++)
{ for(space=1;space<=n-1;space++)
{
cout<<" ";
}
for(k=0;k!=2*i-1;k++)
{
cout<<"*";
}
k=0;
cout<<"\n";
}
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{ int i;space,n,k=0;
clrscr();
cout<<"Enter the no. of rows:";
cin>>n;
for(i=1;i<=n;i++)
{ for(space=1;space<=n-1;space++)
{
cout<<" ";
}
for(k=0;k!=2*i-1;k++)
{
cout<<"*";
}
k=0;
cout<<"\n";
}
getch();
}
Comments
Post a Comment