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.
Câu 4:
uses crt;
var a:array[1..100]of integer;
i,n,dem,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
t:=0;
for i:=1 to n do
if (10<a[i]) and (a[i]<20) then
begin
inc(dem);
t:=t+a[i];
end;
writeln('So phan tu lon hon 10 va nho hon 20 la: ',dem);
writeln('Tong cac phan tu lon hon 10 va nho hon 20 la: ',t);
readln;
end.
Câu 5:
uses crt;
var a:array[1..100]of integer;
i,n,dem,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
t:=0;
for i:=1 to n do
if a[i] mod 2=0 then
begin
inc(dem);
t:=t+a[i];
end;
writeln('So so chan la: ',dem);
writeln('Tong cac so chan la: ',t);
readln;
end.
Bài 1:
uses crt;
var a:array[1..100]of integer;
i,n,min:integer;
begin
clrscr;
write('n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
min:=a[1];
for i:=1 to n do
if min>a[i] then min:=a[i];
writeln(min);
readln;
end.
Bài 2:
uses crt;
var a:array[1..100]of integer;
i,n,max:integer;
begin
clrscr;
write('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.
#include <bits/stdc++.h>
using namespace std;
long long a,b;
int main()
{
cin>>a>>b;
cout<<max(a,b);
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int a;
int main()
{
cin>>a;
if (a>10) cout<<"ban nhap so lon hon 10";
else cout<<"ban nhap so nho hon 10";
return 0;
}
program TinhTong;
uses crt;
var
n, i, tong: integer;
begin
clrscr;
write('Nhap vao so nguyen duong n: ');
readln(n);
tong := 0;
for i := 1 to n-1 do begin
if i mod 2 <> 0 then
tong := tong + i;
end;
writeln('Tong cac so khong chia het cho 2 la: ', tong);
readln;
end.
program TimSoNhoNhat;
uses crt;
var
n, i: integer;
a, min: real;
begin
clrscr;
write('Nhap so phan tu cua day: ');
readln(n);
write('Nhap cac phan tu cua day: ');
readln(a);
min := a;
for i := 2 to n do
begin
readln(a);
if a < min then
min := a;
end;
writeln('So nho nhat trong day la: ', min:0:2);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
double a,b;
int main()
{
cin>>a>>b;
cout<<min(a,b);
return 0;
}