From e4fa1dbcaff547dbb14febd704b3acf218b32d3d Mon Sep 17 00:00:00 2001 From: faizan Ahamed Date: Sun, 19 Apr 2020 18:49:08 +0530 Subject: [PATCH 1/6] Create stairs_pattern.cpp --- others/stairs_pattern.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 others/stairs_pattern.cpp diff --git a/others/stairs_pattern.cpp b/others/stairs_pattern.cpp new file mode 100644 index 000000000..fcc768016 --- /dev/null +++ b/others/stairs_pattern.cpp @@ -0,0 +1,38 @@ +/* +This program is use to print the following pattern + ** + ** + **** + **** + ****** + ****** +******** +******** +where number of pairs line is given by user +*/ +#include +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; + } +} From e15dd6ec99c14efff4b9fd4f5fc6c4c040d22993 Mon Sep 17 00:00:00 2001 From: faizan Ahamed Date: Sun, 19 Apr 2020 20:23:48 +0530 Subject: [PATCH 2/6] Update stairs_pattern.cpp --- others/stairs_pattern.cpp | 40 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/others/stairs_pattern.cpp b/others/stairs_pattern.cpp index fcc768016..07ebc7571 100644 --- a/others/stairs_pattern.cpp +++ b/others/stairs_pattern.cpp @@ -12,27 +12,21 @@ where number of pairs line is given by user */ #include 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; - } +int main(){ +int l, st = 2, x, r, z, n, sp; +std::cout << "enter Index "; +std::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++){ +std::cout << " "; } +for (l = 1; l <= st; l++){ +std::cout << "*"; +} +std::cout <<"\n"; +} +st = st + 2; +}} From 2b01decae19a35c93af94a10b6bd61973a3e7708 Mon Sep 17 00:00:00 2001 From: faizan Ahamed Date: Sun, 19 Apr 2020 20:24:28 +0530 Subject: [PATCH 3/6] Update stairs_pattern.cpp --- others/stairs_pattern.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/others/stairs_pattern.cpp b/others/stairs_pattern.cpp index 07ebc7571..e4fdba79f 100644 --- a/others/stairs_pattern.cpp +++ b/others/stairs_pattern.cpp @@ -11,7 +11,6 @@ This program is use to print the following pattern where number of pairs line is given by user */ #include -using namespace std; int main(){ int l, st = 2, x, r, z, n, sp; std::cout << "enter Index "; From 9ac7981fed8260be2df07d35651b6b79d6775d3c Mon Sep 17 00:00:00 2001 From: faizan Ahamed Date: Sun, 19 Apr 2020 20:39:06 +0530 Subject: [PATCH 4/6] Update stairs_pattern.cpp --- others/stairs_pattern.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/others/stairs_pattern.cpp b/others/stairs_pattern.cpp index e4fdba79f..c93782805 100644 --- a/others/stairs_pattern.cpp +++ b/others/stairs_pattern.cpp @@ -8,21 +8,20 @@ This program is use to print the following pattern ****** ******** ******** -where number of pairs line is given by user -*/ -#include -int main(){ +where number of pairs line is given by user */ +#include +int main() { int l, st = 2, x, r, z, n, sp; std::cout << "enter Index "; std::cin >> x; z = x; -for (r = 1; r <= x; r++){ +for (r = 1; r <= x; r++) { z = z - 1; -for (n = 1; n <= 2; n++){ -for (sp = 1; sp <= z; sp++){ +for (n = 1; n <= 2; n++) { +for (sp = 1; sp <= z; sp++) { std::cout << " "; } -for (l = 1; l <= st; l++){ +for (l = 1; l <= st; l++) { std::cout << "*"; } std::cout <<"\n"; From c2316e1efcb59d7d349b4dc09471e3eece59b5b0 Mon Sep 17 00:00:00 2001 From: faizan Ahamed Date: Sun, 19 Apr 2020 20:50:42 +0530 Subject: [PATCH 5/6] Update stairs_pattern.cpp --- others/stairs_pattern.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/others/stairs_pattern.cpp b/others/stairs_pattern.cpp index c93782805..36c106bb2 100644 --- a/others/stairs_pattern.cpp +++ b/others/stairs_pattern.cpp @@ -8,7 +8,8 @@ This program is use to print the following pattern ****** ******** ******** -where number of pairs line is given by user */ +where number of pairs line is given by user +*/ #include int main() { int l, st = 2, x, r, z, n, sp; From 039ca7bdea9fe931e929bfc802f108bcdc536e98 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 19 Apr 2020 17:48:48 +0200 Subject: [PATCH 6/6] Update others/stairs_pattern.cpp --- others/stairs_pattern.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/others/stairs_pattern.cpp b/others/stairs_pattern.cpp index 36c106bb2..281446a2f 100644 --- a/others/stairs_pattern.cpp +++ b/others/stairs_pattern.cpp @@ -10,7 +10,7 @@ This program is use to print the following pattern ******** where number of pairs line is given by user */ -#include +#include int main() { int l, st = 2, x, r, z, n, sp; std::cout << "enter Index ";