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.
Program hoc24;
Var i,n: integer;
A: array[1..20] of integer;
I,n : integer;
T: longint;
Begin
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=1 then t:=t+a[i];
Write(T);
READLN
END.
uses crt;
var a:array[1..20]of integer;
i,n,t:integer;
begin
clrscr;
n:=20;
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
begin
write(a[i]:4);
t:=t+a[i];
end;
writeln;
writeln('Tong cac so le la: ',t);
readln;
end.
1:
#include <bits/stdc++.h>
using namespace std;
long long n=10, a[10],i,nn;
int main()
{
for (i=1; i<=n; i++) cin>>a[i];
nn=a[1];
for (i=2; i<=n; i++) nn=min(nn,a[i]);
cout<<nn;
return 0;
}
uses crt;
var a: array[1..100] of longint;
i,n,max,min: longint;
begin
clrscr;
readln(n);
for i:=1 to n do
begin
write('Nhap so thu ',i,': ');
readln(a[i]);
end;
max:=a[1]; min:=a[1];
for i:=1 to n do
begin
if max<a[i] then max:=a[i];
if min>a[i] then min:=a[i];
end;
writeln('So lon nhat trong mang la: ',max);
write('So nho nhat trong mang la: ',min);
readln
end.
#include <bits/stdc++.h>
using namespace std;
long long a[1000],n,i,dem1,dem2;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++) cout<<a[i]<<" ";
cout<<endl;
dem1=0;
dem2=0;
for (i=1; i<=n; i++)
{
if (a[i]%2==0) dem1++;
else dem2++;
}
cout<<dem1<<" "<<dem2;
return 0;
}
Bài 5:
Var a:array:[1..1000] of integer;
i,n,max:integer;
sc, sl:longint;
Begin
Write('n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i,' = ');rreadlna[i]);
If a[i] mod 2 = 0 then sc:=sc+b[i];
If a[i] mod 2 <> 0 then sl:=sl+a[i];
End;
max:=a[1];
For i:=2 to n do
If a[i] > max then max:=a[i];
Writeln('Tong cac so chan la ',sc);
Writeln('Tong cac so le la ',sl);
write('So lon nhat la ',max);
Readln
End.
uses crt;
var a: array[1..100] of integer;
i: longint;
begin
clrscr;
for i:=1 to 20 do readln(a[i]);
writeln('day vua nhap la:');
for i:=1 to 20 do write(a[i],' ');
readln
end.
uses crt;
var a:array[1..20]of integer;
i,n:integer;
begin
clrscr;
n:=20;
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to n do
write(a[i]:4);
readln;
end.
program In_Day_So_Nguyen;
uses crt;
var
a: array[1..80] of integer;
i: integer;
begin
clrscr;
writeln('Nhap vao day so nguyen: ');
for i := 1 to 80 do
begin
readln(a[i]);
end;
writeln('Day so nguyen ban vua nhap la: ');
for i:=1 to 80 do
begin
write(a[i], ' ');
end;
readln;
end.
uses crt;
var i:integer;
a:array[1..100]of integer;
begin
clrscr;
for i:=1 to 20 do
begin
write('a[',i,']=');readln(a[i]);
end;
for i:=1 to 20 do
if a[i] mod 2=1 then write(a[i]:3);
readln;
end.