TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
Loading...
Searching...
No Matches
stairs_pattern.cpp File Reference

This program is use to print the following pattern. More...

#include <iostream>
Include dependency graph for stairs_pattern.cpp:

Go to the source code of this file.

Functions

int main ()
 

Detailed Description

This program is use to print the following pattern.

   \*\*
   \*\*
  \*\*\*\*
  \*\*\*\*
 \*\*\*\*\*\*
 \*\*\*\*\*\*
\*\*\*\*\*\*\*\*
        

where number of pairs line is given by user

Definition in file stairs_pattern.cpp.

Function Documentation

◆ main()

int main ( void )

main function

Definition at line 17 of file stairs_pattern.cpp.

17 {
18 int l, st = 2, x, r, z, n, sp;
19 std::cout << "Enter number of pair - ";
20 std::cin >> x;
21 z = x;
22 for (r = 1; r <= x; r++) {
23 z = z - 1;
24 for (n = 1; n <= 2; n++) {
25 for (sp = 1; sp <= z; sp++) {
26 std::cout << " ";
27 }
28 for (l = 1; l <= st; l++) {
29 std::cout << "\\*";
30 }
31 std::cout << std::endl;
32 }
33 st = st + 2;
34 }
35}
double l(double x)
Another test function.