#include <iostream>
using namespace std;
int main()
{
int x, y, z;
cout << "how many elements? " << endl;
cin >> x;
int arr[x];
for(int i = 0; i < x; i++)
{
cout << "give number" << endl;
cin >> arr[i];
}
cout << endl;
y = 0;
z = 0;
// for(int i = y; i >= 0; i-z)
while (z < x)
{
for(int i = y; i < x; i++)
{
for(int i = z; i < x-y; i++)
{
cout << arr[i] << " ";
}
cout << endl;
y++;
}
z++;
cout << z;
}
// while (z < x);
return 0;
}
I want my parameter z
, which is in the while
loop, to link with parameter i=z
in the second for
loop. I want the program to print numbers from 1 to n
, then from 2 to n
, and so on, to the moment it will print only n
.
Don't mind this cout<<z;
in line 30, I was checking if this even works.