Create stairs_pattern.cpp

This commit is contained in:
faizan Ahamed 2020-04-19 18:49:08 +05:30 committed by GitHub
parent f659bcc9fc
commit e4fa1dbcaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

38
others/stairs_pattern.cpp Normal file
View File

@ -0,0 +1,38 @@
/*
This program is use to print the following pattern
**
**
****
****
******
******
********
********
where number of pairs line is given by user
*/
#include <iostream>
using namespace std;
int main()
{
int l, st = 2, x, r, z, n, sp;
cout << "enter Index ";
cin >> x;
z = x;
for (r = 1; r <= x; r++)
{
z = z - 1;
for (n = 1; n <= 2; n++)
{
for (sp = 1; sp <= z; sp++)
{
cout << " ";
}
for (l = 1; l <= st; l++)
{
cout << "*";
}
cout << endl;
}
st = st + 2;
}
}