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.
Viết bình thường một lệnh cũng được mà, mình không biết làm 2 lệnh
program Tinh_hieu;
var n,i: integer;
S: longint;
begin
write('Nhap so n='); readln(n);
S:=0;
for i:=1 to n do S:=S-i;
writeln('Hieu cua ',n,' so tu nhien dau tien S=', S);
readln
end.
program Tinh_hieu;
uses crt;
var i,n: integer;
S: longint;
begin
clrscr;
write('Nhap so n = ');readln(n);
i:=1;
S:=0;
while i<=n do
begin
S:=S-i;
readln;
end.
Var s1,s2,i,j:integer;
Begin
s1:=1;
s2:=0;
i:=2;
j:=4;
While i<=50 do
Begin
s1:=s1+i;
i:=i+2;
End;
While j<=20 do
Begin
s2:=s2+j;
j:=j+4;
End;
s2:=s2+32;
Writeln('Tong day N = ',s1);
Writeln('Tong day M = ',s2);
Readln;
End.
Uses Crt;
Var A : Array [1..100] Of Integer ;
i , j , n , T : Integer ;
BEGIN
Clrscr ;
Write(' Do dai cua day so N = ') ; Readln (N) ;
Writeln (' Nhap day so : ') ;
For i := 1 To N Do
Begin
Write('A[', i ,'] = ') ; Readln ( A ) ;
End ;
i := 1 ;
While (i <= n-1) Do
Begin
j := i+1;
While j<=n do
Begin
If A[j] < A then
Begin
T := A[j];
A[j ] := A;
A := T ;
End ;
j := j + 1;
End ;
i := i + 1;
End ;
Writeln(' Day sau khi sap xep : ') ;
For i := 1 To N Do Write(A : 4) ;
Readln ;
END .
2/ program bt;
var N,i:integer;
begin
write('nhap so N'); readln(N);
writeln;
writeln (' bang nhan ', N);
writeln;
for i:=1 to 10 do writeln(N,'x',1:2,'= ', N*1;3); end
readln
end.
Mik chỉ bít làm bài 2 thôi!
program loc_so_le;
uses crt;
var N,y: longint;
begin
Writeln('Nhap so N '); Readln(N);
for y:=1 to N do if (y mod 2) <>0 then Writeln (y,' la so le');
Readln;
end.
program tim_uoc;
uses crt;
var i,n,tong:integer;
begin
clrscr;
write('nhap so n:');readln(n);
i:=1;tong:=0;
writeln('cac uoc cua ',n,' la:');
while i<=n do
if n mod i=0 then
begin
write(i:3);
inc(i);
end;
writeln;
i:=1;writeln('cac uoc chan:');
while i<=n do
begin
if n mod i=0 then
begin
if i mod 2=0 then write(i:3);
tong:=tong+i;
end;
end;
writeln;
write('tong cac uoc chan:',tong);
readln;
end.
uses crt;
var n,i,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
i:=1;
writeln('Cac uoc cua ',n,' la: ');
while i<=n do
begin
if n mod i=0 then write(i:4):
i:=i+1;
end;
writeln;
writeln('Cac uoc chan cua ',n,' la: ');
t:=0;
i:=1;
while i<=n do
begin
if (n mod i=0) then
begin
t:=t+i;
write(i:4);
end;
inc(i);
end;
writeln('Tong cac uoc chan cua ',n,' la: ',t);
readln;
end.
program TinhTongTich;
var
N, i, Tong, Tich:integer;
begin
writeln('Nhap so nguyen duong N:');
readln(N);
i:=1;
Tong:=0;
Tich:=1;
while i<=N do
begin
Tong:=Tong+i;
Tich:=Tich*i;
i:=i+1;
end;
writeln('Tong cac so tu 1 den ', N, ' la: ', Tong);
writeln('Tich cac so tu 1 den ', N, ' la: ', Tich);
readln;
end.
var n, sum : integer;
begin
write('Nhap n: ');
readln(n);
sum := 0;
while n > 0 do
begin
sum := sum + n;
n := n - 1;
end;
writeln('Tong la: ', sum);
end.
uses crt;
var i,n:integer;
begin
clrscr;
readln(n);
for i:=1 to n do if n mod i=0 then write(i:4);
readln;
end.