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..50]of longint;
i,n:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
for i:=1 to n do write(a[i]:4);
readln;
end.
Bài 1
Var a:array:[1..1000] of integer;
i,n:integer;
s:longint;
Begin
Write('n = ');readln(n);
For i:=1 to n do
Begin
Write('Nhap so thu ',i,' = ');readln(a[i]);
s:=s+a[i];
End;
Write('Cac so vua nhap la: ');
For i:=1 to n do
Write(a[i]:8);
writeln;
write('Tong cac so la ',s);
Readln
End.
Bài 1:
Uses crt;
var i,n,j:integer;
a,b,c:array[1..100000] of integer;
Begin
clrscr;
readln(n);
for i:= 1 to n do readln(a[i]);
for i:= 1 to n do readln(b[i]);
j:=0;
for i:= 1 to n do
Begin
inc(j);
c[j] := a[i];
inc(j);
c[j] := b[i];
end;
for i:= 1 to j do write(c[i],' ');
readln;
end.
uses crt;
var a:array[1..10000]of integer;
i,n,kt,j:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
for i:=1 to n do
if a[i]>1 then
begin
kt:=0;
for j:=2 to trunc(sqrt(a[i])) do
if a[i] mod j=0 then kt:=1;
if kt=0 then write(a[i]:4);
end;
readln;
end.
uses crt; var i,n,a,b, uc,bcnn:integer ;
c:array[1..100] of integer;
{--- CTC tim UCLL hai so} function ucln(a,b:integer):integer;
var r:integer;
begin r:=a mod b;
while r<>0 do begin a:=b; b:=r; r:= a mod b;
end;
ucln:=b;
end;
{--- CTC chinh----} begin Write('n= ');
readln(n);
for i:=1 to n do begin write('c[',i,']=');
readln(c[i]);
end;
for i:= 1 to n do
Write(c[i]:3);
writeln;
uc:=ucln(c[1], c[2]);
bcnn:=(c[1]*c[2])div uc;
for i:=3 to n do begin uc:=ucln(uc,c[i]);
bcnn:= bcnn*c[i] div uc;
end;
Writeln('bcnn =',bcnn); readln; end.
var i,n,min,max:integer;
a:array[1..1000] of integer;
begin
Write('n=');read(n);
for i:=1 to n do
Read(a[i]);
i:=1;
max:=0;
min:=a[i];
while i<n do
Begin
if a[i] > max then max:=a[i];
if a[i] <min then min:=a[i];
i:=i+1;
end;
writeln('Gia tri LN la:',max);
writeln('Gia tri NN la:',min);
readln;
end.