I am trying to figure out how to print these number patterns.

pattern 1

     6
    56
   456
  3456
 23456
123456

pattern 2

     1
    212
   32123
  4321234
 543212345
65432123456

pattern 1 can be printed like this..you can follow the same method to output pattern 2

while(no_of_rows) {
    while(no_of_columns) {
        calc no. of columns of spaces
        while(no_of_columns_for_spaces) {
            print spaces
            decrement no_of_columns_for_spaces
        }
        calc no. of columns of numbers
        while(no_of_columns_for_numbers) {
            print numbers
            decrement no_of_columns_for_numbers
        }
        decrement no_of_columns
    }
    decrement no_of_rows
}
commented: Good answer +14
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.