1 Replies - 189 Views - Last Post: 03 July 2013 - 06:38 PM Rate Topic: -----

#1 winniekaur  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 01-July 13

print upside down triangle with numbers

Posted 03 July 2013 - 06:12 PM

out put of my code is
Enter number of rows: 5
5 4 3 2 1
5 4 3 2
5 4 3
5 4
5
Press any key to continue . . .

i want my numbers like this >>>
1 2 3 4 5
6 7 8 9
10 11 12
13 14
15



#include<iostream>

using namespace std;

 

int main()

{

    int rows, k=0;

    cout << "Enter number of rows: ";

    cin >> rows;



    for(int i =rows; i>=1; i--)

    {

        for(int j=i; j>=1; j--)

        {

            cout << j+k << " " ;

        }

        ++k;

        cout << endl;

         

    }

 

    return 0;

}



Is This A Good Question/Topic? 0
  • +

Replies To: print upside down triangle with numbers

#2 jimblumberg  Icon User is offline

  • member icon


Reputation: 3988
  • View blog
  • Posts: 12,302
  • Joined: 25-December 09

Re: print upside down triangle with numbers

Posted 03 July 2013 - 06:38 PM

Duplicate topic closed.

Jim
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1