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