Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include <ctype.h>
- int main(){
- int i,j,n,m;
- int zbirglavna=0,zbirsporedna=0;
- int mat[100][100];
- scanf("%d%d",&n,&m);
- for(i=0;i<n;i++){
- for(j=0;j<m;j++){
- scanf("%d",&mat[i][j]);
- }
- }
- for(i=0;i<n;i++){
- for(j=0;j<m;j++){
- if(i==j)
- zbirglavna+=mat[i][j];
- if(i+j==n-1)
- zbirsporedna+=mat[i][j];
- }
- }
- for(i=0;i<n;i++){
- for(j=0;j<m;j++){
- if(i>j)
- mat[i][j]=zbirglavna;
- if(i<j)
- mat[i][j]=zbirsporedna;
- }
- }
- for(i=0;i<n;i++){
- for(j=0;j<m;j++){
- printf(" %d ",mat[i][j]);
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement