Advertisement
Dizzy3113

Untitled

Jan 4th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int a[26][26], i, j, n, nr=1;
  8. cin>>n;
  9. for(i=1; i<=n; i++)
  10. for(j=1; j<=n; j++)
  11. {
  12. if(i==n)
  13. {
  14. a[i][j]=nr;
  15. nr++;
  16. }else if(i<j)
  17. a[i][j]=0;
  18. else
  19. a[i][j]=a[i-1][j]+a[i][j-1];
  20. }
  21.  
  22.  
  23. for(i=1; i<=n; i++)
  24. {
  25. for(j=1; j<=n; j++)
  26. cout<<a[i][j]<<" ";
  27. cout<<endl;
  28. }
  29.  
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement