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.
Bài 1:
uses crt;
var a:array[1..100]of integer;
i,n:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to n do
if a[i] mod 2<>0 then write(a[i]:4);
readln;
end.
Bài 2:
uses crt;
var a:array[1..100]of integer;
i,n:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to n do
if a[i] mod 2=0 then write(a[i]:4);
readln;
end.
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.
Câu 1:
var i,n:integer;
s:longint;
begin
Write('n = ');readln(n)
for i:=1 to n do
s:=s+2*i+1;
write('tong la: ',s);
readln
end.
Câu 2
Bài 5:
Var b:array:[1..1000] of integer;
i,n,max:integer;
Begin
Write('n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i,' = ');readln(b[i]);
End;
Write('Cac phan tu am la: ');
For i:=1 to n dko
if b[i]<0 then write(b[i]:8);
writeln;
max:=b[1];
For i:=2 to n do
If b[i] > max then max:=b[i];
write('So lon nhat la ',max);
Readln
End.
Câu 1:
uses crt;
var a:array[1..200]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(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..20]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;
for i:=1 to n do
write(a[i]:4);
writeln;
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln('Tong cua day la: ',t);
for i:=1 to n do
if a[i]>50 then write(a[i]:4);
writeln;
for i:=1 to n do
if a[i]<30 then write(a[i]:4);
readln;
end.
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.
Program HOC24;
var i,m: integer;
t: longint;
a: array[1..1000] of integer;
begin
write('Nhap so phan tu M: '); readln(m);
for i:=1 to m do
begin
write('Nhap so thu ',i,': '); readln(a[i]);
end;
for i:=1 to m do if a[i]<0 then t:=t+a[i];
write('Tong la: ',t);
readln
end.