Bạn chưa đăng nhập. Vui lòng đăng nhập để hỏi bài

Những câu hỏi liên quan
Vũ Phương Anh
Xem chi tiết
Hai Phạm
Xem chi tiết
nguyễn an phát
19 tháng 3 2021 lúc 20:45

program tim_max;

uses crt;

var i,n,max:integer;

x:array[1..100]of byte;

begin

clrscr;

write('nhap so n:');readln(n);

i:=1;

while i<=n do

begin

write('x[',i,']=');readln(x[i]);

i:=i+1;

end;

max:=x[1];i:=1;

while i<=n do

begin

if max<x[i] then max:=x[i];

i:=i+1;

end;

write('so lon nhat la:',max);

readln;

end.

NGUYỄN LÊ XUÂN THỊNH
Xem chi tiết
Kiều Vũ Linh
23 tháng 2 2023 lúc 11:23

Bài 1

Var s,i:integer;

tb:real;

Begin

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

i:=1;

s:=0;

While i<=n do

Begin

s:=s+i;

i:=i+1;

End;

tb:=s/n;

Writeln('Tong la ',s);

Write('Trung binh la ',tb:10:2);

Readln;

End.

Kiều Vũ Linh
23 tháng 2 2023 lúc 11:27

Bài 2

Var i,n,souoc:integer;

Begin

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

i:=1;

While i <= n do

Begin

i:=i + 1;

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

End;

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

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

Readln;

End.

nguyễn thị kim ngân
Xem chi tiết
Minh Lệ
16 tháng 4 2023 lúc 22:25

Program HOC24;

var p: longint;

i,x: integer;

Begin

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

p:=1;

for i:=3 to x do if i mod 2=1 then p:=p*i;

write('P = ',p);

readln

end.

Linh Nhi
Xem chi tiết
Nguyễn Lê Phước Thịnh
4 tháng 3 2022 lúc 9:22

a: uses crt;

var i,n:integer;

s:real;

begin

clrscr;

s:=0;

for i:=1 to 100 do s:=s+1/i;

writeln(s:4:2);

readln;

end.

b: 

uses crt;

var i,n:integer;

s:real;

begin

clrscr;

s:=0;

i:=0;

while i<=100 do 

begin

inc(i);

s:=s+1/i;

end;

writeln(s:4:2);

readln;

end.

Quỳnh Đỗ
Xem chi tiết
việt lê
Xem chi tiết
HuyNoPro
Xem chi tiết
Hquynh
18 tháng 2 2021 lúc 19:56

Cho các câu lệnh sau chỉ ra câu lệnh đúng:

A: for i:=1 to 10; do x:=x+1;

B: for i:=1 to 10 do x:=x+1;

C: for i:=10 to 1 do x:=x+1;

D: for i=10 to 1 do x:=x+1;

Minh Cao
18 tháng 2 2021 lúc 20:18

Cho các câu lệnh sau chỉ ra câu lệnh đúng:

A: for i:=1 to 10; do x:=x+1;

B: for i:=1 to 10 do x:=x+1;

C: for i:=10 to 1 do x:=x+1;

D: for i=10 to 1 do x:=x+1;

Nguyễn Lê Phước Thịnh
18 tháng 2 2021 lúc 20:44

Chọn B nhé bạn

KhanhHuy
Xem chi tiết
nguyễn an phát
21 tháng 3 2021 lúc 19:06

lệnh for...to...do:

a)program tinh_tong;

uses crt;

var i,s:byte;

begin

  clrscr;

  s:=0;

  for i:=1 to 9 do s:=s+i;

  write(s);

readln;

end.

b)

program tinh_tong;

uses crt;

var i,s:byte;

begin

  clrscr;

  s:=0;

  for i:=1 to 14 do

begin

if i mod 2=0 then

s:=s+i;

end;

  write(s);

readln;

end.

c)

program tinh_tong;

uses crt;

var i,s:byte;

begin

  clrscr;

  s:=0;

  for i:=1 to 15 do

begin

if i mod 2=1 then

s:=s+i;

end;

  write(s);

readln;

end.

lệnh while...do

a)program tinh_tong;

uses crt;

var i,s:byte;

begin

  clrscr;

  s:=0;

  i:=1;

while i<=9 do

begin

  s:=s+i;

i:=i+1;

end;

  write(s);

readln;

end.

b)program tinh_tong;

uses crt;

var i,s:byte;

begin

  clrscr;

  s:=0;

  i:=1;

while i<=14 do

begin

if i mod 2=0 then

  s:=s+i

else i:=i+1;

end;

  write(s);

readln;

end.

c)

program tinh_tong;

uses crt;

var i,s:byte;

begin

  clrscr;

  s:=0;

  i:=1;

while i<=15 do

begin

if i mod 2=1 then

  s:=s+i

else i:=i+1;

end;

  write(s);

readln;

end.