hello can you make and run a program that will display the numbers 1,2,3, and so on depending on the number of lines the user will enter.

example output: enter a number=3
1
23
456

thanks for the help..

7
Contributors
6
Replies
7
Views
8 Years
Discussion Span
Last Post by kes166

Yes.

Yes

No one's complete your homework for you. (It's also discouraged here at DaniWeb)

To get you started, you have to use Nested loops.
The outer loop can control the number of lines, and the inner loop can control the number of numbers per line (which will be the same as line no. )
To obtain the actual numbers which are being displayed, you can use a variable which is initialized to 1 and the incremented as required (figure that out)

Edited by anantk: n/a

Hi! can you make and run a program that will display the numbers and so on depending on the number of lines the user will enter.

example if the value of N is 4 the output will be like this:

N=4

4321
321
21
1

thanks ! :))

Hi! can you make and run a program that will display the numbers and so on depending on the number of lines the user will enter.

example if the value of N is 4 the output will be like this:

N=4

4321
321
21
1

thanks ! :))

:yawn: Wow, not only is this a hijack, it's a "givemetehcodez" hijack of an identical "givemetehcodez" :yawn:.
Read this. (Check out the "Keep It Organized" section)
Then try again...

Edited by Fbody: n/a

``````if (n == 1)
cout << "1";
else if (n == 2)
cout <<"1"<<endl<<"23";}
else if (n == 3)
cout <<"1"<<endl<<"23"<<endl<<"456";
else if (n == 4)
...``````

Repeat the sequence until you reach the maximum possible input for int which is I think 32,767.

After it's done, don't post your code :twisted:

Edited by kes166: n/a