Những câu hỏi liên quan
Lê Tiến Thành
Xem chi tiết
Vũ Quang Huy
12 tháng 3 2022 lúc 9:26

tk

uses crt;

var m,n,t,i:integer;

begin

clrscr;

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

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

t:=0;

for i:=m to n do 

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

writeln('Tong cac so chan tu ',m,' den ',n,' la: ',t);

readln;

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
14 tháng 3 2022 lúc 15:55

uses crt;

var n,i,t,dem:integer;

begin

clrscr;

readln(n);

if n mod 2=0 then 

begin

t:=0;

for i:=1 to n do 

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

writeln(t);

end

else 

begin

t:=0;

dem:=0;

for i:=1 to n do 

 if i mod 2=1 then 

begin

t:=t+i;

dem:=dem+1;

end;

writeln(t/dem:4:2);

end;

readln;

end.

Bình luận (0)
huỳnh duy cát
Xem chi tiết
Nguyễn Lê Phước Thịnh
20 tháng 3 2021 lúc 19:53

a)

uses crt;

var i,n:integer;

begin

clrscr;

repeat

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

until n<100;

if n mod 2=0 then 

begin

for i:=0 to n do 

  if i mod 2=0 then write(i:4);

end

else writeln(n,' khong la so chan');

readln;

end.

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

b)

uses crt;

var i,n:integer;

begin

clrscr;

repeat

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

until n<100;

if n mod 2=1 then 

begin

for i:=1 to n do 

  if i mod 2=1 then write(i:4);

end

else writeln(n,' khong la so le');

readln;

end.

Bình luận (0)
Lê Bích Thủy
Xem chi tiết
Đỗ Tuệ Lâm
17 tháng 2 2022 lúc 14:08

{PROGRAM Bai_tap1;
USES crt;
VAR n, i, C, L:Bytbe;
BEGIN 
  clrscr;
  Write('Nhap n:');Readln(n);
  C:=0;L:=0;
  For i:=1 to n do
    If i mod 2=0 then C:=C+i else L:=L+i;
  writeln('Tong cac so chan la:',C);
  writeln ('Tong cac so le la:',L);
  Readln;
end.  
}

Bình luận (0)
tho hit co
Xem chi tiết
Vũ Minh Quân
Xem chi tiết
Phía sau một cô gái
16 tháng 4 2023 lúc 20:34

program Tong_Binh_Phuong_So_Chan;

uses crt;

var n, i, sum: integer;

begin

     clrscr;

     write('Nhap vao so nguyen n (6 < n < 30): ');

     readln(n);

     sum := 0;

     for i := 2 to n do

          if i mod 2 = 0 then

               sum := sum + i * i;

     writeln('Tong binh phuong cac so chan tu 1 den ', n, ' la: ', sum);

     readln;

end.

Bình luận (0)
Phan Thị Ka
Xem chi tiết
Minh Lệ
19 tháng 3 2023 lúc 22:40

Câu 1:

Program HOC24;

var i,p: integer;

t: longint;

begin

write('Nhap P: '); readln(p);

t:=0;

for i:=1 to p do if i mod 2<>0 then t:=t+i;

write('Tong cac so le la: ',t);

readln

end.

Bình luận (0)
Minh Lệ
19 tháng 3 2023 lúc 22:41

Câu 2:

Program HOC24;

var i,n: integer;

t: longint;

begin

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

t:=0;

for i:=1 to n do if i mod 2=0 then t:=t+i;

write('Tong cac so chan la: ',t);

readln

end.

Bình luận (0)
Minh Lệ
19 tháng 3 2023 lúc 22:42

Câu 3:

Program HOC24;

var i,t,n: integer;

begin

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

t:=0;

for i:=1 to n do if n mod i=0 then t:=t+i;

write('Tong cac uoc cua ',n,' la: ',t);

readln

end.

Bình luận (0)
San San
Xem chi tiết
Nguyễn Trung Hiếu
20 tháng 3 2022 lúc 7:21

Câu 1: 
uses crt;
var s,i,n:integer;
begin clrscr;
s:=0;
write('Nhap n: ');readln(n);
for i:=1 to n do
if i mod 2 <> 0 then inc(s,i);
write('Tong cac so le tu 1 den ',n,' la: ',s);
readln
end.

Bình luận (0)
Nguyễn Trung Hiếu
20 tháng 3 2022 lúc 7:22

Câu 2:
uses crt;
var s,i,n:integer;
begin clrscr;
s:=0;
write('Nhap n: ');readln(n);
for i:=1 to n do
if i mod 2 = 0 then inc(s,i);
write('Tong cac so le tu 1 den ',n,' la: ',s);
readln
end.

Bình luận (0)
Như Ý
Xem chi tiết
Phía sau một cô gái
1 tháng 5 2023 lúc 19:27

Câu 1:

program Tinhtong:

var

     n, i, sum: integer;

begin

     write('Nhap n: ');

     readln(n);

     sum := 0;

     for i := 2 to n do

     begin

          if i mod 2 = 0 then

          begin

               sum := sum + i;

          end;

     end;

     writeln('Tong cac so chan tu 2 toi ', n, ' la ', sum);

     readln; 

end.

Câu 2:

program Tinhtong:

var

     n, i, sum: integer;

begin

     write('Nhap n: ');

     readln(n);

     sum := 0;

     for i := 1 to n do

     begin

          if i mod 2 = 1 then

          begin

               sum := sum + i;

          end;

     end;

     writeln('Tong cac so le tu 1 toi ', n, ' la ', sum);

     readln;

end.

Bình luận (1)
Đặng Tiến Đức
Xem chi tiết
Lee Hà
9 tháng 12 2021 lúc 10:16

program Chanle;

uses crt;

var x: integer;

begin

clrscr;

readln(x)

if (x mod 2 = 0) then write('day la so chan') else write('day la so le');

readln

end.

Bình luận (0)