-
December 9th, 2010, 12:15 AM
#1
number pattern
please help me print this pattern using for loop
1 2 3 4
5 6 7
8 9
10
10
9 8
7 6 5
4 3 2 1
-
December 9th, 2010, 12:46 AM
#2
Re: number pattern
What's your question? Nobody is going to do your homework for you.
-
December 12th, 2010, 02:26 AM
#3
Re: number pattern
So it looks like you just need a counting sequence, but also need to enter a newline after so many numbers are printed. The first line has 4 numbers and on down to 1...so you could accomplish this with a loop that loops through 1-10...you then have a variable that represents the number of numbers you will print on this line...it starts at 4 so your for loop would check each time "if number=number_of_numbers_per_line" then print a carriage return and decrement the "number_of_numbers_per_line" variable...
You could do this again a second time, but the loop decrements and the number_of_numbers_per line increments.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|