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;
n,i:integer;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
if n<=0 then writeln('Ban nhap sai, yeu cau nhap lai');
until n>0;
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.
program tiendien;
uses crt;
var a:longint;
td:real;
begin
clrscr;
write('nhap so KW nha Tuan da dung=');readln(a);
if a<=100 then td:=1110*a else
if a<=150 then td:=1110*100+(a-100)*1470 else
td:=1110*100+1470*50+(a-150)*1600;
writeln('so tien nha Tuan phai tra la:',td+0.1*td:9:0,' VND');
readln
end.
Câu 1:
uses crt;
var n,i,kt:integer;
begin
clrscr;
write('Nhap n='); readln(n);
if n<2 then writeln(n,' khong la so nguyen to')
else begin
kt:=0;
for i:=2 to n-1 do
if n mod i=0 then kt:=1;
if kt=0 then writeln(n,' la so nguyen to')
else writeln(n,' khong la so nguyen to');
end;
readln;
end.
Câu 2:
uses crt;
var a:array[1..100]of integer;
i,n,max,min:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',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 la: ',max);
writeln('So nho nhat la: ',min);
readln;
end.
THAM KHẢO:
uses crt;
var a,cv,dt:integer;
begin
clrscr;
write('a='); readln(a);
cv:=a*4;
dt:=sqr(a);
if a>0 then
begin
writeln('chu vi hinh vuong la: ',cv);
writeln('dien tich hinh vuong la: ',dt);
end
else writeln('vui long nhap so a lon hon 0');
readln;
end.
Program Hinh_tron;
Uses crt;
Var r,dt:real;
Begin
clrscr;
Writeln(' Nhap ban kinh hinh tron:');
Readln(r);
dt:= r*r*3.14;
Writeln('Dien tich hinh tron la:',dt);
Readln;
End.
program im_14424;
uses crt;
var A: array[1..100000] of integer;
S,i,n: integer;
begin
clrscr;
write('Nhap vao n: ');
readln(n);
S:=0;
for i:=1 to n do
begin
write('Nhap A[',i,']: ');
readln(A[i]);
if (A[i] mod 2 = 0 then S:=S+i;
end;
write(S);
readln
end.
C1:
Var
a:integer;b: integer;
Begin
a:=0;
Writeln('Hay nhap nam can tinh:');
readln(b);
a:=b-2003;
if a>9 and a<20 then
writeln('Nam dang o trong tuoi vi thanh nien.')
else
writeln('Nam khong o trong tuoi vi thanh nien.');
readln;
end.