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.
Bài 1:
uses crt;
var n,i,s:integer;
begin
clrscr;
write('Nhap n='); readln(n);
s:=0;
i:=1;
while i<=n do
begin
s:=s+i;
inc(i);
end;
writeln('Tong cac so trong khoang tu 1 den ',n,' la: ',s);
readln;
end.
Bài 2:
uses crt;
var n,i,s:integer;
begin
clrscr;
write('Nhap n='); readln(n);
s:=0;
i:=1;
while i<=n do
begin
s:=s+i;
i:=i+2;
end;
writeln('Tong cac so le trong khoang tu 1 den ',n,' la: ',s);
readln;
end.
Câu 1:
a) var a:array[1..50]of real;
b) a[5]:=8;
c) for i:=1 to 50 do
begin
write('A[',i,']='); readln(a[i]);
end;
for i:=1 to 50 do
write(a[i]:4);
Câu 2:
uses crt;
var s,i:integer;
begin
clrscr;
s:=0;
for i:=1 to 10 do
s:=s+i;
writeln(s);
readln;
end.
uses crt;
var n,i,t,s:integer;
begin
clrscr;
repeat
readln(n);
until n<>0;
t:=0;
for i:=1 to n do if i mod 2=0 then t:=t+i;
writeln(t);
s:=1;
for i:=1 to n do
if i mod 2=1 then s:=s*i;
writeln(s);
readln;
end.
uses crt;
var a,t,i:integer;
begin
clrscr;
t:=0;
for i:=1 to 6 do
begin
readln(a);
if (a mod 2=0) then t:=t+a;
end;
writeln(t);
readln;
end.
program TimBoi4ChuSo;
var
n, i: integer;
begin
repeat
writeln('Nhap vao so nguyen n (2<n<100): ');
readln(n);
until (n > 2) and (n < 100);
writeln('Cac boi cua ', n, ' co 4 chu so la: ');
for i := 1000 to 9999 do
begin
if i mod n = 0 then
writeln(i);
end;
end.
program MultiplesOfN;
var
n, i: integer;
begin
repeat
write('Nhap vao so nguyen duong n (0<n<100): ');
readln(n);
until (n > 0) and (n < 100);
writeln('Cac boi so cua ', n, ' co 4 chu so la:');
for i := 1000 to 9999 do
begin
if (i mod n = 0) then
begin
writeln(i);
end;
end;
readln;
end.
uses crt;
var n:real;
begin
clrscr;
repeat
readln(n);
if (n<1) or (n>10) then writeln('Hay nhap lai');
until (1<=n) and (n<=10);
readln;
end.