Number pattern using for loop.

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

  1. Prahlad Makwana

    Prahlad Makwana New Member

    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. Prahlad Makwana

    Prahlad Makwana New Member

    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