I've got the initial part but....
Code:
#include <iostream>
using namespace std;
#include <conio.h>
int main()
{
int n;
int x=1;
cout << "Please ask for nonnegative integer: ";
cin >> n;
cout << endl;
while ((n > 0) && (x != (n + 1)))
{cout << x << " ";
x++;}
if (x = n)
n--;
else
{ cout << x << " ";}
cout << endl;
getch();
return 0;
}
I'm supposed to write code that will accept a positive integer 'n' and display (ie if integer is 7):
1 2 3 4 5 6 7
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
I get the first line to print out but am a loss to get the rest of it to print.
Suggestions please!!!
mb