print floyd 27s triangle

Solutions on MaxInterview for print floyd 27s triangle by the best coders in the world

showing results for - "print floyd 27s triangle"
Leni
30 Feb 2016
1#include <iostream>
2using namespace std;
3
4int main()
5{
6    int rows, number = 1;
7
8    cout << "Enter number of rows: ";
9    cin >> rows;
10
11    for(int i = 1; i <= rows; i++)
12    {
13        for(int j = 1; j <= i; ++j)
14        {
15            cout << number << " ";
16            ++number;
17        }
18
19        cout << endl;
20    }
21
22    return 0;
23}