Nhập 2 mảng 1 chiều các Word. Hãy tìm tổng của mảng nào nhỏ hơn cho nhận xét. Ví dụ: Mảng 1: 1 2 3 4 5 Mảng 2: 3 4 1 6 7
Lập Trình Assember
giúp em với ạ
Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
uses crt;
var a:array[1..100]of integer;
i,n,t,j,tam:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
for i:=1 to n do write(a[i]:5);
writeln;
writeln('Cac so duong la: ');
for i:=1 to n do if (a[i]>0) then write(a[i]:4);
writeln;
t:=0;
for i:=1 to n do
if a[i] mod 3=0 then t:=t+a[i];
writeln(t);
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]<a[j] then
begin
tam:=a[i];
a[i]:=a[j];
a[j]:=tam;
end;
for i:=1 to n do write(a[i]:4);
readln;
end.
program PSMCG;
uses crt;
const N = 5;
type MangA = array[1..N] of integer;
var A: MangA;
i, max, min, sum: integer;
begin
for i := 1 to N do
begin
write('Nhap phan tu A[', i, ']: ');
readln(A[i]);
end;
writeln('Mang A: ');
for i := 1 to N do
begin
write(A[i], ' ');
end;
writeln;
max := A[1];
min := A[1];
for i := 2 to N do
begin
if A[i] > max then max := A[i];
if A[i] < min then min := A[i];
end;
writeln('Gia tri lon nhat la: ', max);
writeln('Gia tri nho nhat la: ', min);
sum := 0;
for i := 1 to N do
begin
sum := sum + A[i];
end;
writeln('Tong gia tri trong mang A la: ', sum);
readln;
end.
program bt;
uses crt;
var i, s, sa, sd, sc, sl, da, dd, dc, dl : integer;
a : array[1..50] of integer;
begin
clrscr;
for i:=1 to 10 do begin
write('Nhap phan tu thu ',i,': '); readln(a[i]);
end;
write('Day so vua nhap la: ');
for i:=1 to 10 do write(a[i],', ');
writeln;
s := 0; sa := 0; sd := 0; sc := 0; sl := 0; da := 0; dd := 0; dc := 0; dl := 0;
for i:=1 to 10 do begin
s := s + a[i];
if (a[i] > 0) then begin sd := sd + a[i]; dd := dd + 1 end;
if (a[i] < 0) then begin sa := sa + a[i]; da := da + 1 end;
if (a[i] mod 2 = 0) then begin sc := sc + a[i]; dc := dc + 1; end
else begin sl := sl + a[i]; dl := dl + 1 end;
end;
writeln('Tong cac phan tu trong mang la ',s);
writeln('Trung binh cong cac phan tu trong mang la ',s/10);
writeln('Tong cac so am la ',sa);
writeln('Tong cac so duong la ',sd);
writeln('Tong cac so chan la ',sc);
writeln('Tong cac so le la ',sl);
writeln('So cac so am la ', da);
writeln('So cac so duong la ', dd);
writeln('So cac so chan la ', dc);
writeln('So cac so le la ', dl);
readln
end.
uses crt;
var a:array[1..100]of integer;
i,n,t,t1,t2:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
t:=t+a[i];
t1:=0;
t2:=0;
for i:=1 to n do
begin
if a[i]>0 then t1:=t1+a[i];
if a[i]<0 then t2:=t2+a[i];
end;
writeln('Tong cac phan tu la: ',t);
writeln('Tong cac so duong la: ',t1);
writeln('Tong cac so am la: ',t2);
writeln('Trung binh cong cua day la: ',t/n:4:2);
readln;
end.
uses crt;
var a:array[1..6]of integer;
i,dem,t:integer;
begin
clrscr;
for i:=1 to 6 do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
t:=0;
for i:=1 to 6 do
if a[i]>0 then
begin
inc(dem);
t:=t+a[i];
end;
writeln('So phan tu duong la: ',dem);
writeln('Tong cac phan tu duong la: ',t);
readln;
end.
1:
uses crt;
var a:array[1..100]of integer;
i,n,max:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
writeln(max);
readln;
end.
2:
uses crt;
var s:real;
i:integer;
begin
clrscr;
s:=0;
for i:=1 to 100 do
s:=s+1/i;
writeln(s:4:2);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long x,n,i,t1,t2,t3;
int main()
{
cin>>n;
t1=0; t2=0; t3=0;
for (i=1; i<=n; i++)
{
cin>>x;
t1+=x;
if (x%2==0) t2+=x;
else t3+=x;
}
cout<<t1<<" "<<t2<<" "<<t3;
return 0;
}
Câu 1:
uses crt;
var a:array[1..100]of integer;
i,n,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln('Tong cac so trong mang la: ',t);
readln;
end.
Câu 2:
uses crt;
var a:array[1..100]of integer;
i,n,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
if a[i] mod 2=0 then t:=t+a[i];
writeln('Tong cac so chan la: ',t);
readln;
end.