number pattern
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 3 of 3

Thread: number pattern

  1. #1
    Join Date
    Dec 2010

    number pattern

    please help me print this pattern using for loop
    1 2 3 4
    5 6 7
    8 9
    9 8
    7 6 5
    4 3 2 1

  2. #2
    Join Date
    Aug 2008

    Re: number pattern

    What's your question? Nobody is going to do your homework for you.

  3. #3
    Join Date
    Oct 2007

    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 you could accomplish this with a loop that loops through then have a variable that represents the number of numbers you will print on this 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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a survey!

HTML5 Development Center