Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int i, j, broj;
- int Pascal[100][100];
- printf("Unesite broj redova(kolona): ");
- scanf("%d", &broj);
- for (i=1;i<=broj;i++)
- {
- for (j=1;j<=broj;j++)
- {
- if (j==1||j==i)
- {
- Pascal[i][j]=1;
- }
- else if (j>i)
- {
- Pascal[i][j]=0;
- }
- else
- {
- Pascal[i][j]=Pascal[i-1][j]+Pascal[i-1][j-1];
- }
- }
- }
- for (i=1;i<=broj;i++)
- {
- for (j=1;j<=broj;j++)
- {
- if (Pascal[i][j]!=0)
- {
- printf("%2d ", Pascal[i][j]);
- }
- }
- printf("\n");
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment