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 n,i:integer;
kt:boolean;
begin
clrscr;
repeat
readln(n);
until n<=100;
if (n<2) then writeln('khong la so nguyen to')
else begin
kt:=true;
for i:=2 to trunc(sqrt(n)) do
if n mod i=0 then kt:=false;
if kt=true then write('la so nguyen to')
else write('khong la so nguyen to');
end;
readln;
end.
uses crt;
var n,i:integer;
kt:boolean;
begin
clrscr;
repeat
readln(n);
until n<=100;
if (n<2) then writeln('khong la so nguyen to')
else begin
kt:=true;
for i:=2 to trunc(sqrt(n)) do
if n mod i=0 then kt:=false;
if kt=true then write('la so nguyen to')
else write('khong la so nguyen to');
end;
readln;
end.
Câu 2:
Program HOC24;
var a: array[1..20] of integer;
t,i: integer;
begin
for i:=1 to 20 do
begin
write('Nhap so thu ',i,' : '); readln(a[i]);
end;
t:=0;
for i:=1 to 20 do
if a[i] mod 2<>0 then t:=t+a[i];
writeln('Tong cac so le la :',t);
readln
end.
Câu 1:
Program HOC24;
var a: array[1..10] of integer;
min,max,i: integer;
begin
for i:=1 to 10 do
begin
write('Nhap so thu ',i,' : '); readln(a[i]);
end;
min:=32000; max:=0;
for i:=1 to 10 do
begin
if max<a[i] then max:=a[i];
if min>a[i] then min:=a[i];
end;
writeln('So lon nhat la :',max);
write('So nho nhat la : ',min);
readln
end.
uses crt;
var a,b:longint;
begin
clrscr;
write('nhap so thu nhat:');readln(a);
write('nhap so thu hai:');readln(b);
if (a mod 2=0) and (b mod 2=0) then
write('ca hai so deu chan')
else if (a mod 2<>0) and (b mod 2<>0) then
write('ca hai so deu le')
else write('ban vua nhap mot so chan va mot so le');
readln;
end.
chúc bạn học tốt
uses crt;
var j,tg,s,max,min,i,n:longint;
a:array[1..19] of longint;
s1:real;
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-1 do
for j:=i+1 to n do
if a[i]>a[j] then
begin
tg:=a[i];
a[i]:=a[j];
a[j]:=tg;
end;
for i:=1 to n do
write(a[i],' ');writeln;
for i:=1 to n do
s:=s+a[i];
s1:=s/n;
writeln(‘Gia tri trung binh cua cac phan tu la: ‘,s1:0:0);
min:=a[1];max:=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];
write('Phan tu lon nhat la: ',max,' ','Phan tu nho nhat la: ',min); writeln;
for i:=1 to n do
if (a[i]<>0) and (a[i] mod 2=0) then write(a[i],' ');
readln
end.
program so_tu_nhien_chan;
uses crt;
var n,i:integer;
begin
clrscr;
write('Nhap n='); readln(n);
write('Cac so chan nho hon hoac bang ',n,' la: ');
for i:=2 to n do
if i mod 2=0 then write(i:4,' ;');
readln;
end.
uses crt;
var a,b,t:integer;
begin
clrscr;
write('a='); readln(a);
write('b='); readln(b);
if (a>5) and (b>5) then
begin
t:=a+b;
writeln('tong la: ',t);
end
else writeln('khong duoc tinh');
readln;
end.
uses crt;
Var x,y,z: Integer;
begin
Write ('Nhap x: '); readln (x);
Write ('Nhap y: '); readln (y);
z:=x + y;
If (x > 5) and (y > 5) then write ('Tong hai so ',x,' va ',y,' la: ',z);
If (x <= 5) or (y <= 5) then write ('Vui long nhap hai so deu lon hon 5');
readln;
end.