mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
34720ae2d3
when we propose 2 backslash then it doesn't take it as a comment and gets printed Co-authored-by: David Leal <halfpacho@gmail.com>
36 lines
725 B
C++
36 lines
725 B
C++
/**
|
|
* @file
|
|
@brief This program is use to print the following pattern<pre>
|
|
\*\*
|
|
\*\*
|
|
\*\*\*\*
|
|
\*\*\*\*
|
|
\*\*\*\*\*\*
|
|
\*\*\*\*\*\*
|
|
\*\*\*\*\*\*\*\*
|
|
********</pre>
|
|
where number of pairs line is given by user
|
|
*/
|
|
#include <iostream>
|
|
|
|
/** main function */
|
|
int main() {
|
|
int l, st = 2, x, r, z, n, sp;
|
|
std::cout << "Enter number of pair - ";
|
|
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 << std::endl;
|
|
}
|
|
st = st + 2;
|
|
}
|
|
}
|