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.
uses crt;
var i,t:integer;
begin
clrscr;
i:=1;
t:=0;
repeat
t:=t+i;
inc(i);
until t>=100;
writeln(t);
readln;
end.
uses crt;
var a:array[1..100]of real;
i,n:integer;
min,t:real;
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:4:2);
t:=0;
for i:=1 to n do
if i mod 2=0 then t:=t+a[i];
writeln('Tong cac phan tu co chi so chan la: ',t:4:2);
readln;
end.
uses crt;var n: longint; chrn: string; valn,sum,max,i,preperror: byte;begin write('Nhap so can kiem tra: '); readln(n); str(n,chrn); for i:=1 to length(chrn) do begin val(chrn[i],valn,preperror); sum:=sum+valn; if max<valn then max:=valn; valn:=0 end; writeln('Ket qua: '); writeln(length(chrn)); writeln(sum); write(max); readln;end.uses crt;var n: longint; chrn: string; valn,sum,max,i,preperror: byte;begin write('Nhap so can kiem tra: '); readln(n); str(n,chrn); for i:=1 to length(chrn) do begin val(chrn[i],valn,preperror); sum:=sum+valn; if max<valn then max:=valn; valn:=0 end; writeln('Ket qua: '); writeln(length(chrn)); writeln(sum); write(max); readln;end.
Program HOC24;
var N:longint;
max,tg,t,d: integer;
Begin
write('Nhap N : '); readln(N);
max:=0;
while n<>0 do
begin
tg:=n mod 10;
d:=d+1;
t:=t+tg;
if tg>max then max:=tg;
n:=n div 10;
end;
writeln('So nguyen N co ',d,' chu so');
writeln('Tong cac chu so cua N la : ',t);
write('Chu so lon nhat cua N la :',max);
readln
end.
program tim_n;
uses crt;
var tong,n,i:word;
begin
clrscr;
n:=1;tong:=0;
while tong<500 do
begin
for i:=1 to n do tong:=tong+i;
if tong<500 then begin tong:=0;n:=n+1;end
else n:=n-1;
end;
write('so n thoa man dieu kien la:',n);
readln;
end.
uses crt;
var i,n,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
t:=0;
for i:=1 to 500 do
begin
t:=t+i;
if t>500 then
begin
writeln(i);
break;
end;
end;
readln;
end.
uses crt;
var n,i,t:integer;
begin
n:=0;
t:=0;
repeat
n:=n+2;
t:=t+n;
until t>69;
writeln(n);
writeln(t);
readln;
end.
python
i = 1
tong = 0
while tong <= 150:
tong += i
i += 1
print("Số lần lặp là:", i-2)
print("Tổng các số tự nhiên liên tiếp là:", tong-i)
#include <iostream>
int main() {
int n;
std::cout << "Nhap so tu nhien n: ";
std::cin >> n;
int sum = 0;
for (int i = 1; i <= n; i++) {
if (i % 3 == 0) {
sum += i;
}
}
std::cout << "Tong cac so tu nhien nho hon hoac bang " << n << " ma chia het cho 3 la: " << sum << std::endl;
return 0;
}
```c++
#include <iostream>
using namespace std;
int main() {
int n, sum = 0;
cout << "Nhap so nguyen duong n: ";
cin >> n;
for (int i = 1; i <= n; i++) {
if (i % 3 == 0) {
sum += i;
}
}
cout << "Tong cac so tu nhien nho hon hoac bang " << n << " ma chia het cho 3 la: " << sum;
return 0;
}
```