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,dem:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
for i:=1 to n do
if (10<a[i]) and (a[i]<20) then inc(dem);
writeln(dem);
readln;
end.
program TimMinMaxTrungBinh;
var
N, i, max, min, sum: integer;
a: array[1..50] of integer;
TB, minTB, maxTB: real;
begin
writeln('Nhap so nguyen duong N:');
readln(N);
sum := 0;
for i := 1 to N do
begin
write('Nhap so thu ', i, ': ');
readln(a[i]);
sum := sum + a[i];
end;
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;
TB := sum / N;
minTB := TB;
maxTB := TB;
for i := 1 to N do
begin
if (a[i] < TB) and (a[i] < minTB) then
minTB := a[i];
if (a[i] > TB) and (a[i] > maxTB) then
maxTB := a[i];
end;
writeln('Gia tri lon nhat la: ', max);
writeln('Gia tri nho nhat la: ', min);
writeln('Gia tri trung binh la: ', TB:2:2);
if minTB = TB then
writeln('Khong co gia tri nao nho hon TB')
else
writeln('Gia tri nho nhat < TB la: ', minTB);
if maxTB = TB then
writeln('Khong co gia tri nao lon hon TB')
else
writeln('Gia tri lon nhat > TB la: ', maxTB);
readln;
end.
Bài 2:
#include <bits/stdc++.h>
using namespace std;
long long x,y;
int main()
{
cin >>x>>y;
cout<<x<<" "<<y;
swap(x,y);
cout<<x<<" "<<y;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a[10],n=10,i,ln;
int main()
{
for (i=1; i<=n; i++) cin>>a[i];
ln=a[1];
for (i=1; i<=n; i++) ln=max(ln,a[i]);
cout<<ln<<endl;
if (ln%2==0) cout<<"Phai";
else cout<<"Khong phai";
return 0;
}
program bt;
uses crt;
var i, max : integer;
a : array[1..10] of integer;
begin
clrscr;
for i:=1 to 10 do begin
write('Nhap so thu ',i,': '); readln(a[i]);
end;
max := 0;
for i:=1 to 10 do if a[i] > max then max := a[i];
if (max mod 2 = 0) then write(max,' la so lon nhat va la so chan')
else write(max,' la so lon nhat va la so le');
readln
end.
program mang;
uses crt;
var n,i,chan, le,max,min: Integer;
a:array[1..100] of integer;
begin
write('nhap so phan tu ');read(n);
for i:=1 to n do
begin
write('nhap so thu ',i); readln(a[i]);
end;
max:=a[1]; min:=a[1]; chan:=0;le:=0;
for i:=1to n do
begin
if a[i] > max then max:=a[i];
if a[i] < min then min:=a[i];
if a[i] mod 2 = 0 then chan:=chan+1
else le:=le+1;
end;
writeln('max la: ',max);
writeln('min la: ',min);
writeln('so phan tu chan: ',chan);
writeln('so phan tu le: ',le);
readln
end.
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(t);
readln;
end.
program Le_Nho_Hon_Hoac_Bang_n;
uses crt;
var
n, i: integer;
begin
clrscr;
write('Nhap vao mot so nguyen duong n: ');
readln(n);
while n <= 0 do
begin
writeln('So ban nhap khong hop le. Xin vui long nhap lai: ');
readln(n);
end;
clrscr;
writeln('Cac so le nho hon hoac bang ', n, ' la:');
i := 1;
while i <= n do
begin
if i mod 2 <> 0 then
writeln(i);
i := i + 1;
end;
readln;
end.
uses crt;
var n,i:integer;
m:real;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until (1<=n) and (n<=30000);
m:=0;
for i:=1 to n do
m:=m+sqrt(i);
writeln('m=',m:4:2);
readln;
end.
đó là câu trả lời cho dòng 1 đúng không ạ