0

I need c++ program which is give out put..

1 2 6 3 7 10 4 8 11 13 5 9 12 14 15

9th Aug 2018, 6:31 PM
ahmed
6 Respostas
+ 4
ahmed this is question answer section.. please don't expect people to code for you entirely... do share your code and let us know where you are confused or stuck... doing it yourself will help you to put your learning into implementation
9th Aug 2018, 6:46 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
9th Aug 2018, 7:21 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
Thanks ketan it's working..
10th Aug 2018, 8:55 AM
ahmed
+ 1
happy to help
10th Aug 2018, 8:56 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
This my code : int number = 1; For (int i=1;i<=5;i++) { For( int j=1;i<=i;j++ ) { cout<<number ; number ++; } cout <<endl; }
9th Aug 2018, 6:54 PM
ahmed
0
In this code, n = number of rows; in your case its 5. for(int i=1; i<=n; i++){ cout<<i<<“ “; for(int j=0, k=i; j<i-1;j++){ k+=n-1-j; cout<<k<<“ “; } cout<<endl; } for n = 5, it will give the pattern u want.ahmed checked it, working...
10th Aug 2018, 9:30 AM
Miqdad
Miqdad - avatar