It may be a bad question for you , but I have a genuine doubt , save your downvotes.
I came across this interesting pattern :
1
2 6
3 7 10
4 8 11 13
5 9 12 14 15
Seems quite easy , but I am not getting it.
My code:
int k = 1;
for (int n = 5 ; n>0 ; n--)
{
for (int x = 1 ; x<=n ; x++)
cout<<k++;
cout<<endl;
}
So the output:
12345
6789
101112
1314
15
You can see that I have achieved a way to get the numbers right , but I am not sure how to get the pattern
Aucun commentaire:
Enregistrer un commentaire