include stdio include locale int main setlocale LC_ALL const int int d

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include<stdio.h>
#include<locale.h>
int main(){
setlocale(LC_ALL," ");
const int n=5;
int a[n][n], i, j, x, k;
double ar , total=0;
long m, buf[n];
void print(){
for(i=0;i<n; i++){
for(j=0;j<n;j++){
printf("%i\t", a[i][j]);}
printf("\n");}
printf("\n\n");}
for(i=0;i<n;i++){
for(j=0;j<n;j++){
printf("a[%i][%i]: ",i+1,j+1);
scanf("%i", &a[i][j]);}}
print();
for (i=0;i<=n;i++){
for (j=1;j<n;j++){
x=a[i][j];
k=j-1;
while(a[i][k]<x && k>=0){
a[i][k+1]=a[i][k];
k--;}
a[i][k+1]=x;}}
print();
for (j=0;j<n; j++){
m=1;
for (i=0; i<n; i++) m=m*a[i][j];
buf[j]=m;
printf ("Добуток елементів стовбця %i=%li\n", j+1, buf[j]);}
for(j=0; j<n; j++) total+=buf[j];
ar=total/n;
printf("Середнє арифметичне: %0.1f \n", ar);
return 0;}