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.
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ài 2:
uses crt;
var a:array[1..30]of integer;
i,n,kt:integer;
begin
clrscr;
write('n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
kt:=0;
for i:=1 to n-1 do
if a[i]>a[i+1] then kt:=1;
if kt=0 then write('Day so khong giam')
else writeln('Day so lon xon');
readln;
end.
1. uses crt;
var a,vt:array[1..100]of integer;
n,i,t,dem:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
repeat
write('A[',i,']='); readln(a[i]);
until a[i]>=0;
end;
t:=0;
for i:=1 to n do
begin
if t<100 then
begin
t:=t+a[i];
dem:=dem+1;
vt[dem]:=i;
end;
end;
writeln(vt[dem]);
readln;
end.
Câu 2:
uses crt;
var a:array[1..30]of integer;
i,n,kt:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
kt:=0;
for i:=1 to n-1 do
if a[i]>=a[j] then kt:=1;
if kt=0 then writeln('Day la day so khong giam')
else writeln('Day khong la day so khong giam');
readln;
end.
Câu 1:
var i,n:integer;
begin
write('n = ');readln(n);
For i:=1 to n do
if i mod 2 = 0 then write(i:6);
readln;
end.
Câu 1:
program chieu_cao;
uses crt;
var Nam, Linh: real;
begin
clrscr;
write ('Nhap chieu cao cua Nam:'); readln (Nam);
write ('Nhap chieu cao cua Linh:'); readln (Trang);
if Nam > Linh then writeln ('Ban Nam cao hon');
if Nam < Linh then writeln ('Ban Linh cao hon') else writeln ('Hai ban cao bang nhau');
readln
end.
Câu 2:
program Tich;
var N,i: interger;
P: longint;
begin
write ('N='); readln (N);
P:=1;
for i:=1 to N do P:=P*i;
writeln (N,' ! = ',P);
readln
end.
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)
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ài 1:
uses crt;
var a:array[1..100]of integer;
i,n,max,min:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1];
min:=a[1];
for i:=1 to n do
begin
if max<a[i] then max:=a[i];
if min>a[i] then min:=a[i];
end;
writeln('Gia tri lon nhat la: ',max);
writeln('Gia tri nho nhat la: ',min);
readln;
end.
Bài 2:
uses crt;
var n,i,s:integer;
begin
clrscr;
write('Nhap n='); readln(n);
s:=0;
for i:=1 to n do
s:=s+i;
writeln('Tong cua ',n,' so tu nhien dau tien la: ',s);
readln;
end.
Bài 3:
uses crt;
var n,t:integer;
begin
clrscr;
n:=0; t:=0;
while t<=1000 do
begin
inc(n);
t:=t+n;
end;
writeln('Tong cua n so tu nhieu dau tien sao cho tong nho nhat lon hon 1000 la: ',t);
writeln('So lan n nang len la: ',n);
readln;
end.
Bài 4:
uses crt;
var a,b:integer;
begin
clrscr;
write('a='); readln(a);
write('b='); readln(b);
if a<b then writeln(a,' ',b);
if a=b then writeln('hai so bang nhau');
if b<a then writeln(b,' ',a);
readln;
end.
Bài 5:
uses crt;
var a:array[1..100]of integer;
i,n,min:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
min:=a[1];
for i:=1 to n do
if min>a[i] then min:=a[i];
writeln('Gia tri nho nhat la: ',min);
readln;
end.
1) var n,sum;
begin
while sum<=1000 do
begin
n:=n+1;
sum:=sum+n;
end;
write('n=',n);
end.
bài thi bên mình không readln đoạn cuối nha bạn, bạn muốn thì thêm vào nha
5)var i,n,tong:longint;
const tich:longint=1;
begin
read(n);
for i:=1 to n do
begin
tong:=tong+i;
tich:=tich*i;
end;
write('tong=',tong);
write('tich=',tich);
end.