Advertisement
Guest User

Untitled

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