C2: Program Cau_2;
Var
A,x:integer;
Begin
clrscr;
writeln('Hay nhap so x:');
readln(x);
A:=0;
A:=x*(2+x)-x;
writeln('Bieu thuc A bang:',A:10:5);
Readln;
end.
C3: Program Cau_3;
Var
b:integer;i:integer;A:array[1..10] of integer;
Begin
i:=1;
for b:=1 to 10 do
if 10 and 20 mod b =0 then
readln(A[i]);
i:=i+1;
writeln('Cac uoc chung cua 10 va 20 la:');
for i:=1 to 10 do
write(A[i]);
readln;
end.
program bai1;
var tong,a:integer;
begin
tong:=0; a:=0;
while tong<150 do
begin
a:=a+1;
tong:=tong+a;
end;
writeln('tong la:',tong);
readln
end.
C1:
Program Tinh_Tong;
uses crt;
var a, N, S: integer;
begin
write('Nhap so a='); readln(a);
S:=0;
for N:=1 to a do
if 1 mod 2 = 0 then S:=S+i;
writeln('tong cua cac so tu 1 den ',a,' nho hon 150);
readln
end.
C2 va C3 kho qua ma lop minh chua hoc nen khong hieu!
Thong cam!!!
C1: Program Cau_1;
Var
S:integer; a:integer;i:integer;
Begin
clrscr;
S:=0;
Writeln('Hay nhap so a:');
readln(a);
for i:=1 to a do
S:=S+i;
if S>=150 then
writeln('Tong cac so tu nhien tu 1 den a lon hon 150')
else
writeln('Tong cac so tu nhien tu 1 den a bang:',S:10:5,'nho hon 150');
readln;
end.
C2:
mỗi cái mình tick các bạn ấn thêm 2 lần nx