programming-examples/c++/Basic/Pattern 10.cpp
2019-11-18 14:44:36 +01:00

31 lines
619 B
C++

//Floyds Triangle
#include <iostream.h>
#include <conio.h>
void main()
{
clrscr(); //clears the previous screen
//Printing pattern
int rows,i,j,space;
cout<<"Enter number of rows: ";
cin>>rows;
for(i=rows; i>=1; --i)
{
for(space=0; space<rows-i; ++space)
cout<<" ";
for(j=i; j<=2*i-1; ++j)
cout<<"* ";
for(j=0; j<i-1; ++j)
cout<<"* ";
cout<<endl;
}
getch(); // wait for input
}
/*
*********
*******
*****
***
*
*/