Number pattern using for loop.

Discussion in 'Programming/Scripts' started by Prahlad Makwana, Oct 24, 2019.

  1. How to create below pattern using for loops in C#
    1 1
    1 2 1
    1 3 3 1
    1 4 6 4 1
    1 5 10 10 5 1
     
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    What is the formula that creates those number sequences?
     
  3. Starting 1 and ending 1 is compulsory and second step is addition of above number one by one like this:
    1 1
    (1) 1+1 = 1 2 1
    (2) 1+2, 2+1 = 1 3 3 1
    (3) 1+3, 3+3, 3+1 = 1 4 6 4 1
    (4) 1+4, 4+6, 6+4, 4+1 = 1 5 10 10 5 1
     

Share This Page