Advertisement
Guest User

cosminbarosul

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