Hii... i really need help... pls help...
so my question is:
how to write a c program to print pascal triangle using for loop ?
its output should be like this
1
2 1
3 2 1
4 3 2 1
5 4 3 2 1
pls guyzz i need to submit it tmrww...
thnx in advance

2
check my solution it is very brief. and it is easily understood.

Answers

2014-08-04T12:50:19+05:30
#include<stdio.h>
long fact(int);
int main()
{
 int line,i,j;
    printf("Enter the no. of lines: ");
    scanf("%d",&line);
    for(i=0;i<line;i++){
    for(j=0;j<line-i-1;j++)
    printf(" ");
    for(j=0;j<=i;j++)
    printf("%ld ",fact(i)/(fact(j)*fact(i-j)));
    printf("\n");}
    return 0;}
long fact(int num)
{
    long f=1;
       int i=1;
      while(i<=num)
{
         f=f*i;         i++;  } 
 return f;
 }

if this helped u...
pls let me know by marking it best! ;) :)
2 4 2
but i hv one confusion , i need this only with for loop nd u hv usd while loop nd also wat abt dis fact...???
hello!!
i'm just an amateur...
i just tried as i saw your question and I've got it!!
and i'll see if i could help u the way you want!!
thnk u so mch...!!!!
pls...... did u get the answer..???
what have you done? the pattern is not what you are printing.....
2014-08-04T15:33:24+05:30

This Is a Certified Answer

×
Certified answers contain reliable, trustworthy information vouched for by a hand-picked team of experts. Brainly has millions of high quality answers, all of them carefully moderated by our most trusted community members, but certified answers are the finest of the finest.
#include <stdio.h>
main()
{
  int row, H , j ;
 
      printf("Height of triangle:  "); 
      scanf("%d", &H);
      for (row=1; row <= H ; row++ )
             for (j = row; j >= 1 ; j--)      // print integers, starting from row number up to 1
                   printf("%d  ", j);
    
}

1 5 1
This is the exact and perfect solution
If you like the solution, rate the answer as brainliest please.