Những câu hỏi liên quan
Hoàng Long Đậu
Xem chi tiết
Nguyễn Lê Phước Thịnh
18 tháng 2 2022 lúc 0:03

uses crt;

var x,n,i,t:integer;

begin

clrscr;

readln(n);

t:=0;

for i:=1 to n do 

begin

readln(x);

if x mod 2=0 then t:=t+x;

end;

writeln(t);

readln;

end.

Bình luận (0)

program ideone;
var i,n,x,res:longint;
begin
readln(n);
res:=0;
for i:=1 to n do 
begin
read(x);
if x mod 2 = 0 then
res:=res+x;
end;
write(res);

end.

Bình luận (0)
Hoài thịnh
Xem chi tiết
Nguyễn Lê Phước Thịnh
28 tháng 2 2023 lúc 22:31

uses crt;

var a:array[1..100]of integer;

i,n,t,j,tam:integer;

begin

clrscr;

readln(n,k);

for i:=1 to n do readln(a[i]);

for i:=1 to n-1 do

for j:=i+1 to n do

if a[i]>a[j] then begin tam:=a[i]; a[i]:=a[j]; a[j]:=tam; end;

write(a[k]);

readln;

end.

Bình luận (0)
Phía sau một cô gái
28 tháng 2 2023 lúc 21:14

program sonho;

var

     arr:array[1..100] of integer;

     k, n, i, min: integer;

begin

     write('Nhap n: ');

      readln(n);

     write('Nhap cac phan tu cua day: ');

     for i := 1 to n do

     begin

          readln(arr[i]);

     end;

     write('Nhap k: ');

     readln(k);

     min := arr[1];

     for i := 2 to k do

     begin

          if (arr[i] < min) then

               min := arr[i];

     end;

     writeln('So nho thu ', k, ' trong day la: ', min);

end.

Bình luận (0)
Bbi thành real
Xem chi tiết
Nguyễn Lê Phước Thịnh
14 tháng 5 2022 lúc 10:53

uses crt;

var i,n,kt:integer;

begin

clrscr;

readln(n);

kt:=0;

for i=2 to trunc(sqrt(n)) do 

 if n mod i=0 then kt:=1;

if (kt=0) and (n>1) then write('phai')

else write('Khong phai');

readln;

end.

Bình luận (0)
Kiều Vũ Linh
14 tháng 5 2022 lúc 13:26

Var i,n,souoc:integer;

Begin

While n <= 1 do

Begin

Write('Nhap n = ');readln(n);

End;

For i:=1 to n do

If n mod i = 0 then souoc:=souoc+1;

If souoc = 2 then write(n,' la so nguyen to')

Else write(n,' khong la so nguyen to');

Readln;

End.

Bình luận (0)
Hoài thịnh
Xem chi tiết
Phía sau một cô gái
27 tháng 2 2023 lúc 19:39

var A:

     array[1..n] of integer;

     i, j, n: integer;

begin

     write('Nhap so phan tu cua mang: ');

     readln(n);

     for i := 1 to n do

     begin

          write('Nhap phan tu thu ', i, ': ');

          readln(A[i]);

     end;

 

     for i := 1 to n - 1 do

         for j := i+1 to n do

            if (A[i] mod 2 = 0) and (A[j] mod 2 = 0) and (A[i] < A[j]) or (A[i] mod 2 = 1) and (A[j] mod 2 = 1) and (A[i] > A[j]) then

            begin

                swap(A[i], A[j]);

            end;

     writeln('Mang da sap xep la: ');

      for i := 1 to n do

         writeln(A[i]);

end.

 
Bình luận (0)
Hương Mai
Xem chi tiết
Kiều Vũ Linh
28 tháng 4 2022 lúc 6:42

Var i,n:integer;

p:longint;

Begin

Write('Nhap n = ');readln(n);

p:=0;

For i:=2 to n do p:=p*i;

Write('Tich la ',p);

Readln;

End.

Bình luận (0)
Kiều Vũ Linh
28 tháng 4 2022 lúc 6:43

Var i,n:integer;

p:longint;

Begin

Write('Nhap n = ');readln(n);

p:=1;

For i:=2 to n do p:=p*i;

Write('Tich la ',p);

Readln;

End.

Bình luận (0)
Phạm Việt Bách
Xem chi tiết
nguyễn an phát
5 tháng 6 2021 lúc 6:53

uses crt;
var i,j,m:integer;
t:longint;
a:array[1..100,1..100]of integer;
begin
  clrscr;
  write('nhap m:');readln(m);
  for i:=1 to m do
  for j:=1 to m do
  begin
    write('a[',i,',',j,']=');readln(a[i,j]);
  end;
  clrscr;
  writeln('ma tran da nhap la:');
  for i:=1 to m do
  begin
    for j:=1 to m do
    write(a[i,j]:5);writeln;
  end;
  i:=1;j:=1;
  while i<=m do
  begin
    t:=t+a[i,j];
    inc(i);inc(j);
  end;
  writeln('tong cac phan tu nam tren duong cheo chinh la: ',t);
  readln;
end.

 

Bình luận (0)
Vy Đan Hà Thị
Xem chi tiết
Minh Lệ
8 tháng 5 2023 lúc 22:02

Program HOC24;

var i,n: integer;

t: longint;

a: array[1..1000] of integer;

begin

write('Nhap n: '); readln(n);

for i:=1 to n do

begin

write('Nhap so thu ',i,': '); readln(a[i]);

end;

t:=0;

for i:=1 to n do t:=t+a[i];

write('Tong la; ',t);

readln

end.

Bình luận (0)
Đỗ Trọng TÍn
Xem chi tiết
Kiều Vũ Linh
29 tháng 4 2023 lúc 7:52

Câu 3:

Var i,n:integer:

Begin

Write('n = ');readln(n);

Write('Cac uoc cua n la ');

For i:=1 to n do

If n mod i = 0 then write(i:8);

Readln

End.

Bình luận (0)
Kiều Vũ Linh
29 tháng 4 2023 lúc 7:56

Câu 4

Var i,n:integer:

Begin

Write('n = ');readln(n);

Write('Cac so le nho hon n la ');

For i:=1 to n - 1 do

If i mod 2 <> 0 then write(i:8);

Readln

End.

Bình luận (1)
Nguyễn Quang Đạt
Xem chi tiết
Nguyên Hưng Trần
26 tháng 7 2021 lúc 20:42

Program Tin_hoc;

uses crt;

var n,i,dem:integer;

      a:array[1..10000] of integer;

Begin

clrscr;

readln(n);

dem:=0;

for i:= 1 to n do 

  Begin

  readln(a[i]);

  if a[i] mod 2 = 0 then inc(dem);

  end;

writeln('Day so co ',dem,' so chan');

readln;

end.

Bình luận (0)