Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок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
6 ответов
+ 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
+ 3
Hi ahmed , please refer below code :
https://code.sololearn.com/cGw2A8khfV90/?ref=app
+ 1
Thanks ketan it's working..
+ 1
happy to help
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;
}
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...