Guest User

Untitled

a guest
Sep 22nd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6. int i, j, broj;
  7. int Pascal[100][100];
  8. printf("Unesite broj redova(kolona): ");
  9. scanf("%d", &broj);
  10. for (i=1;i<=broj;i++)
  11. {
  12. for (j=1;j<=broj;j++)
  13. {
  14. if (j==1||j==i)
  15. {
  16. Pascal[i][j]=1;
  17. }
  18. else if (j>i)
  19. {
  20. Pascal[i][j]=0;
  21. }
  22. else
  23. {
  24. Pascal[i][j]=Pascal[i-1][j]+Pascal[i-1][j-1];
  25. }
  26. }
  27. }
  28.  
  29. for (i=1;i<=broj;i++)
  30. {
  31. for (j=1;j<=broj;j++)
  32. {
  33. if (Pascal[i][j]!=0)
  34. {
  35. printf("%2d ", Pascal[i][j]);
  36. }
  37. }
  38. printf("\n");
  39. }
  40. return 0;
  41. }
Add Comment
Please, Sign In to add comment