Guest User

Untitled

a guest
Nov 20th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <stdio.h>
  2. void main()
  3. {
  4. int x,y,n,a,z,s;
  5. printf("Enter the limit: ");
  6. /*limit implies number second from edge in Pascal's tringle*/
  7. scanf("%d",&n);
  8. printf("\n\n");
  9.  
  10. s=n;
  11. for(x=0; x<=n; x++)
  12. {
  13. a=1;
  14. for(z=s; z>=0; z--)
  15. printf(" ");
  16.  
  17. s--;/* s is for printing the space*/
  18. for(y=0; y<=x; y++)
  19. {
  20. printf("%d ",a);
  21. a=a*(x-y)/(y+1);
  22. /* cell value for next iteration will be calculated in current iteration as:
  23. a = [ a * ( row_val - col_val ) ] / ( col_val + 1 ) */
  24. }
  25. printf("\n");
  26. }
  27. getch();
  28. }
Add Comment
Please, Sign In to add comment