You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
675 B
C++
34 lines
675 B
C++
5 years ago
|
#include <iostream.h>
|
||
|
#include <conio.h>
|
||
|
void main()
|
||
|
{
|
||
|
clrscr(); //clears the previous screen
|
||
|
//Printing pattern
|
||
|
int i,space,rows,k=0;
|
||
|
cout<<"Enter the number of rows: ";
|
||
|
cin>>rows;
|
||
|
for(i=1; i<=rows; ++i)
|
||
|
{
|
||
|
for(space=1; space<=rows-i; ++space)
|
||
|
{
|
||
|
cout<<" ";
|
||
|
}
|
||
|
while(k!=2*i-1)
|
||
|
{
|
||
|
cout<<"* ";
|
||
|
++k;
|
||
|
}
|
||
|
k=0;
|
||
|
cout<<"\n";
|
||
|
}
|
||
|
getch(); // wait for input
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
*
|
||
|
***
|
||
|
*****
|
||
|
*******
|
||
|
*********
|
||
|
|
||
|
*/
|