ответ:Program a10;
var a,b:Array [1..100,1..100] of integer;
k,i,n,j,s:integer;
Begin
read(n);
For i:=1 to n do
begin
For j:=1 to n do
read(a[i,j]);
end;
i:=0;j:=0;s:=0;k:=0;
while i<=n do
i:=i+1;j:=j+1;
if(a[i,j]>0)then k:=k+1;
s:=s+a[i,j];
writeln(k,' ',s);
end.
2)
Program a10;
var a,b:Array [1..100,1..100] of real;
k,i,n,m,j:integer;
s:real;
read(n,m);
For j:=1 to m do
k:=0;
for j:=1 to m do
s:=0;
for i:=1 to n do
if(a[i,j]>(s-a[i,j]))then k:=k+1;
writeln(k);
Объяснение:
ответ:Program a10;
var a,b:Array [1..100,1..100] of integer;
k,i,n,j,s:integer;
Begin
read(n);
For i:=1 to n do
begin
For j:=1 to n do
begin
read(a[i,j]);
end;
end;
i:=0;j:=0;s:=0;k:=0;
while i<=n do
begin
i:=i+1;j:=j+1;
if(a[i,j]>0)then k:=k+1;
s:=s+a[i,j];
end;
writeln(k,' ',s);
end.
2)
Program a10;
var a,b:Array [1..100,1..100] of real;
k,i,n,m,j:integer;
s:real;
Begin
read(n,m);
For i:=1 to n do
begin
For j:=1 to m do
begin
read(a[i,j]);
end;
end;
k:=0;
for j:=1 to m do
begin
s:=0;
for i:=1 to n do
begin
s:=s+a[i,j];
end;
for i:=1 to n do
begin
if(a[i,j]>(s-a[i,j]))then k:=k+1;
end;
end;
writeln(k);
end.
Объяснение:
#include <stdio.h>
int main(void)
{const int n=10;
int ar[n],i,j,k,c;
i=0;
while(i<n)
{scanf("%d",&ar[i]);
i++;}
printf(" \nfirst array \n");
i=0;
while(i<n)
{printf("%d ",ar[i]);
i++;}
i=0;
k=0;
while(i<n)
{if(ar[i]%5==0)
{c=ar[i];
ar[i]=ar[k];
ar[k]=c;
k++;}
i++;}
printf(" \n1 fin array \n");
i=0;
while(i<n)
{printf("%d ",ar[i]);
i++;}
i=0;
while(i<(n-1))
{j=i+1;
while(j<n){
if(ar[i]>ar[j])
{c=ar[i];
ar[i]=ar[j];
ar[j]=c;}
j++;}
i++;}
printf("\n2 fin array \n");
i=0;
while(i<n)
{printf("%d ",ar[i]);
i++;}
return 0;
}
Пример ввода:
1
5
2
10
3
15
4
20
5
25
Пример вывода:
first array
1 5 2 10 3 15 4 20 5 25
1 fin array
5 10 15 20 5 25 4 1 3 2
2 fin array
1 2 3 4 5 5 10 15 20 25