Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uses crt;
- var a:array[1..50,1..50] of integer;
- r,c,i,j,tong1,tong2,dem1,dem2:integer;
- tbc:real;
- begin
- clrscr;
- write('Nhap so dong, so cot: ');
- readln(r,c);
- // Nhap mang
- for i:=1 to r do
- for j:=1 to c do
- begin
- write('Nhap a[',i,',',j,']:' );
- readln(a[i,j]);
- end;
- // Xuat mang
- for i:=1 to r do
- begin
- for j:=1 to c do
- write(a[i,j]);
- writeln;
- end;
- // Tinh tong cac phan tu
- tong1:=0;
- for i:=1 to r do
- for j:=1 to c do
- tong1:=tong1+a[i,j];
- // Dem cac phan tu co gia tri chan
- dem1:=0;
- for i:=1 to r do
- for j:=1 to c do
- if (a[i,j] mod 2 = 0) then
- dem1:=dem1+1;
- // Tinh TBC cac phan tu co gia tri le
- dem2:=0;
- tong2:=0;
- tbc:=0;
- for i:=1 to r do
- for j:=1 to c do
- begin
- tong2:=tong2+a[i,j];
- dem2:=dem2+1;
- end;
- tbc:=tong2/dem2;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement