Search C Program | nimishsoft@gmail.com

Pascal Triangle

1
1 1
1 2 1
1 3 3 1 
1 4 6 4 1

long fact(int);

int main()
{
   int i, j;
   for (i=0;i<5;i++)
   {
      for(j=0;j<=i;j++)
      {
         printf("%ld ",fact(i)/(fact(j)*fact(i-j)));
      }
      printf("\n");
   }
   return 0;
}
 
long fact(int n)
{
    int i;
    long f = 1;
    for(i=1;i<=n;i++)
      f = f*i;
    return f;
}


Related Links:
- More Number Pattern Programs
- Star Pattern Programs in C
- Alphabet Pattern Programs in C
- Series Programs in C

18 comments:

  1. #include
    void main()
    {
    int i,num=1;
    for(i=1;i<=5;i++)
    {
    printf("%d",num);
    num=num*11;
    printf("\n");
    }
    }

    ReplyDelete
    Replies
    1. good observation

      Delete
    2. THE SAME PATTERN IS PRINTED 5 TIME. WHY???

      Delete
    3. SRY IT WAS MY MISTAKE I FOUND IT

      Delete
    4. dude Soumya Sourav ....wrong observation in 6th iteration

      Delete
    5. Attention everyone, the file provided above is not working. I have been looking for the working file and finally found it.



      ✔️Click Here To Download http://gestyy.com/e0GAyS
      ✔️Click Here To Download

      ✔️Click Here To Download http://exe.io/XONVsO6l

      ✔️Click Here To Download


      ✔️Click Here To Download
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .

      .

      .
      .

      .

      .
      .
      .
      .

      Mn.
      ..

      .
      .
      .
      ..
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      ..
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .
      .xzzx
      .sdcccxxx

      Delete
  2. public class PascalTriangle {

    public static void main(String[] args) {

    int rows = 10;


    for(int i =0;i<rows;i++) {
    int number = 1;
    System.out.format("%"+(rows-i)*2+"s","");
    for(int j=0;j<=i;j++) {
    System.out.format("%4d",number);
    number = number * (i - j) / (j + 1);

    }
    System.out.println();
    }

    }
    }

    ReplyDelete
  3. int i,j,k,b,m=1;
    int mul(int);
    int main()
    {
    for(i=1;i<=5;i++)
    {



    printf("%d",m);
    mul(m);




    printf("\n");
    }
    }
    int mul(int i)
    {
    m=m*11;



    return m;
    }

    ReplyDelete
  4. #include
    int main()
    {
    int rows, coef = 1, i, j;
    printf("Enter number of rows: ")
    scanf("%d",&rows);
    for(i=0; i<rows; i++)
    {
    for(j=0; j <= i; j++)
    {
    if (j==0 || i==0)
    coef = 1;
    else
    coef = coef*(i-j+1)/
    printf("%4d", coef);
    }

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. 0
    11
    112
    1123
    11235
    pls tell about this

    ReplyDelete
  7. 1
    1 1
    1 2 1
    1 2 3 1
    1 2 3 4 1
    1 2 3 4 5 1
    Please help me for this

    ReplyDelete
  8. 2
    2 5
    2 5 10
    2 5 10 17
    what is the program of this pattern

    ReplyDelete
  9. Really nice blog, very infromative. You can refer more topics related to C language like C pointers and C Programs from here for future articles

    ReplyDelete
  10. This comment has been removed by the author.

    ReplyDelete
  11. <a href="https://saivi.optisolbusiness.com/Data Scraping Service available in USA </a>

    ReplyDelete