Những câu hỏi liên quan
Hiền Nguyễn
Xem chi tiết
Hiền Nguyễn
24 tháng 3 2021 lúc 9:08

Bạn ơi giúp mình với chiều nay mình thi rồi

 

Bình luận (0)
Nguyễn Lê Phước Thịnh
24 tháng 3 2021 lúc 20:16

Câu 2: 

uses crt;

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

i,n,tb:integer;

begin

clrscr;

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

for i:=1 to n do 

  begin

write('A[',i,']='); readln(a[i]);

end;

tb:=0;

for i:=1 to n do 

  tb:=tb+a[i];

writeln(tb/n:4:2);

readln;

end.

Bình luận (0)
Nhân lê
Xem chi tiết
Phía sau một cô gái
22 tháng 4 2023 lúc 20:43

program TongSoChanTrongDay;

var

      n, i, tong: integer;

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

begin

      tong := 0;

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

      readln(n);

      for i := 1 to n do

      begin

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

            readln(a[i]);

            if a[i] mod 2 = 0 then

                  tong := tong + a[i];

      end;

      writeln('Tong cac phan tu chan trong day la: ', tong);

      readln;

end.

Bình luận (0)
Đỗ Thành Nhân
3 tháng 5 lúc 11:13

fgfgfgfgfgfggfgfgfggggfgf

Bình luận (0)
Nguyễn Trần Hồng Ngọc
Xem chi tiết
Phía sau một cô gái
7 tháng 5 2023 lúc 20:02

program TinhTBCTimSoNT;

var
  ten, lop: string;
  n, i, tong, dem: integer;
  A: array [1..11] of integer;
  trung_binh: real;

function LaSoNguyenTo(x: integer): boolean;
var
  i: integer;
begin
  if x < 2 then
    LaSoNguyenTo := false
  else if x = 2 then
    LaSoNguyenTo := true
  else if x mod 2 = 0 then
    LaSoNguyenTo := false
  else
  begin
    i := 3;
    while (i <= trunc(sqrt(x))) and (x mod i <> 0) do
      i := i + 2;
    LaSoNguyenTo := x mod i <> 0;
  end;
end;

begin
  // Nhập tên và lớp của học sinh
  write('Nhập tên của học sinh: ');
  readln(ten);
  write('Nhập lớp: ');
  readln(lop);

  // Nhập dãy số nguyên và tính trung bình cộng
  repeat
    write('Nhập số phần tử của dãy số (n<12): ');
    readln(n);
  until n < 12;
  tong := 0;
  for i := 1 to n do
  begin
    write('Nhập phần tử thứ ', i, ': ');
    readln(A[i]);
    tong := tong + A[i];
  end;
  trung_binh := tong / n;

  // In tên, lớp, dãy số và trung bình cộng ra màn hình
  writeln('Học sinh: ', ten);
  writeln('Lớp: ', lop);
  write('Dãy số: ');
  for i := 1 to n do
    write(A[i], ' ');
  writeln;
 
  // In các số nguyên tố của dãy số ra màn hình
  writeln('Các số nguyên tố của dãy số:');
  for i := 1 to n do
    if LaSoNguyenTo(A[i]) then
      writeln(A[i]);
end.

Bình luận (0)
Cầu Nguyễn
Xem chi tiết
HT.Phong (9A5)
24 tháng 4 2023 lúc 13:43

Uses crt;

var i,n,k,u,f,y: longint;

a: array[1..100] of longint;

begin clrscr;

readln(n);

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

writeln(a[i]);

for i:=1 to n do if(a[i]<0) then k:=k+a[i];

for i:=1 to n do if(a[i]>0) then u:=u+a[i];

for i:=1 to n do if(a[i] mod 2<>0) then f:=f+a[i];

for i:=1 to n do if(a[i] mod 2=0) then y:=y+a[i];

writeln('Tong cac so am la: ',k);

writeln('Tong cac so khong am: ',u);

writeln('Tong cac so le la: ',f);

writeln('Tong cac so chan la: ',y);

readln;

end.

Bình luận (0)
Vẹt Vẹt
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 4 2022 lúc 17:04

uses crt;

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

i,n,t:integer;

begin

clrscr;

readln(n);

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

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

writeln;

t:=0;

for i:=1 to n do 

if a[i]>0 then t:=t+a[i];

writeln(t);

readln;

end.

Bình luận (1)
Yeu DUong nhat
Xem chi tiết
Minh Lệ
17 tháng 5 2021 lúc 21:57

Program HOC24;

var n,d,i: integer;

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

t: longint;

begin

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

for i:=1 to n do 

begin

write('B[',i,']='); readln(b[i]);

end;

d:=0; t:=0;

for i:=1 to n do 

if b[i]>0 then

begin

d:=d+1;

t:=t+b[i];

end;

writeln('Tong cac so duong trong day so la: ',t);

write('Co ',d,' so duong trong day');

readln

end.

Bình luận (0)
Lê Thị Thu Phương
7 tháng 6 2021 lúc 21:22

uses crt;
var b:array[1..100] of longint;
      n,i,d,s:longint;
begin
      clrscr;
      write('n='); readln(n);
      for i:=1 to n do 
            begin
                  write('a[',i,']: '); readln(b[i]);
                  if b[i]>0 then begin
                        inc(d);
                        inc(s,b[i]);
                  end;
            end;
      writeln('Tong cac so duong: ',s);
      writeln('Co ',d,' so duong');
      readln;
end.

Bình luận (0)
Tali
Xem chi tiết
Nguyễn Lê Phước Thịnh
10 tháng 5 2021 lúc 17:52

uses crt;

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

i,n:integer;

t:real;

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 

t:=t+a[i];

writeln('Tong cua day la: ',t:4:2);

writeln('Trung binh cong cua day la: ',t/n:4:2);

readln;

end.

Bình luận (1)
HUY HUỲNH QUANG
Xem chi tiết
Kiều Vũ Linh
5 tháng 5 2023 lúc 14:54

Bài 5:

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

i,n,max:integer;

sc, sl:longint;

Begin

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

For i:=1 to n do

Begin

Write('Nhap so thu ',i,' = ');rreadlna[i]);

If a[i] mod 2 = 0 then sc:=sc+b[i];

If a[i] mod 2 <> 0 then sl:=sl+a[i];

End;

max:=a[1];

For i:=2 to n do

If a[i] > max then max:=a[i];

Writeln('Tong cac so chan la ',sc);

Writeln('Tong cac so le la ',sl);

write('So lon nhat la ',max);

Readln

End.

Bình luận (1)
Leoumax
Xem chi tiết
Nguyễn Lê Phước Thịnh
23 tháng 2 2023 lúc 20:54

Bai 2:

uses crt;

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

i,n,t,nn:integer;

begin

clrscr;

readln(n);

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

nn:=a[1];

for i:=1 to n do

if nn>a[i] then nn:=a[i];

write(nn);

readln;

end.

Bình luận (0)