#include<stdio.h>
#include <stdlib.h>
#include <time.h>
#define N 10
int Factorial(int number){
int fact = 1;
int i;
if(number > 0){
for(i = number; i > 0; i--)
fact *= i;
}
else if(number == 0){
fact = 1;
}
else{
fact = 0;
}
return fact;
}
int main(){
int Matrix[N+1][N+1];
int Aux;
srand (time(NULL));
for(int i = 0; i < N*N; i++)
//printf("(%d, %d)\n",i/N, i%N);
Matrix[i/N][i%N] = rand() % 100;
for(int i = 0; i < N*N; i++)
{
if(i%N == 0)
Aux = -100000;
if(Matrix[i/N][i%N] > Aux)
Aux = Matrix[i/N][i%N];
if(i%N == (N-1))
Matrix[i/N][N] = Aux;
}
for(int i = 0; i < N*N; i++){
if(i%N == 0)
Aux = -100000;
if(Matrix[i%N][i/N] > Aux)
Aux = Matrix[i%N][i/N];
if(i%N == (N-1))
Matrix[N][i/N] = Aux;
}
Aux = -100000;
for(int i = 0; i < N; i++){
if(Matrix[i][i] > Aux)
Aux = Matrix[i][i];
}
Matrix[N][N] = Aux;
for(int i = 0; i < (N+1)*(N+1); i++){
if(i%(N+1) == 0)
printf("\n");
printf("%d ", Matrix[i/(N+1)][i%(N+1)]);
}
/*for(int i = 0; i < N+1; i++){
printf("\n");
for(int j = 0; j < N+1; j++)
printf("%d ", Matrix[i][j]);
}*/
printf("\n");
/*
for(int i = 0; i < N; i++){
Matrix[N][i] = Factorial(Matrix[N][i]);
Matrix[i][N] = Factorial(Matrix[i][N]);
}
Matrix[N][N] = Factorial(Matrix[N][N]);
*/
return 0;
}