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.
Program vct;
uses crt;
var
m,n,i:integer;
begin
writeln('moi nhap so n '); readln(n);
writeln('moi nhap so m '); readln(m);
for i:=m to n do write(i);
readln;
end.
program bai1;
var m,n,s:longint;
begin
write('M= ');readln(m);
write('N= ');readln(n);
for k:=(m+1) to (n-1) do
begin
s:=0;
for i:=1 to n do
if (k mod i=0) then s:=s+1;
if s=2 then write(k,' ');
end;
readln
end.
Câu 4:
uses crt;
var a:array[1..100]of integer;
i,n,dem,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
t:=0;
for i:=1 to n do
if (10<a[i]) and (a[i]<20) then
begin
inc(dem);
t:=t+a[i];
end;
writeln('So phan tu lon hon 10 va nho hon 20 la: ',dem);
writeln('Tong cac phan tu lon hon 10 va nho hon 20 la: ',t);
readln;
end.
Câu 5:
uses crt;
var a:array[1..100]of integer;
i,n,dem,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
t:=0;
for i:=1 to n do
if a[i] mod 2=0 then
begin
inc(dem);
t:=t+a[i];
end;
writeln('So so chan la: ',dem);
writeln('Tong cac so chan la: ',t);
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,dem:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
for i:=1 to n do
if (10<a[i]) and (a[i]<20) then inc(dem);
writeln(dem);
readln;
end.
program Le_Nho_Hon_Hoac_Bang_n;
uses crt;
var
n, i: integer;
begin
clrscr;
write('Nhap vao mot so nguyen duong n: ');
readln(n);
while n <= 0 do
begin
writeln('So ban nhap khong hop le. Xin vui long nhap lai: ');
readln(n);
end;
clrscr;
writeln('Cac so le nho hon hoac bang ', n, ' la:');
i := 1;
while i <= n do
begin
if i mod 2 <> 0 then
writeln(i);
i := i + 1;
end;
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.
#include <bits/stdc++.h>
using namespace std;
long long i,n,kt,j;
int main()
{
cin>>n;
for (i=2; i<=n; i++)
{
kt=0;
for (j=2; j*j<=i; j++)
if (i%j==0) kt=1;
if (kt==0) cout<<i<<" ";
}
return 0;
}
1:
uses crt;
var t,x,i,n:integer;
begin
clrscr;
t:=0;
n:=10;
for i:=1 to n do
begin
readln(x);
t:=t+x;
end;
write(t);
readln;
end.
2:
uses crt;
var dem,x,i,n:integer;
begin
clrscr;
dem:=0;
n:=10;
for i:=1 to n do
begin
readln(x);
if x mod 2=0 then inc(dem);
end;
write(dem);
readln;
end.
3
program Cacsole;
uses crt;
var M, N, i: integer;
begin
clrscr;
write ('Nhap M= '); readln(M);
write ('Nhap N= '); readln(N);
for i := M to N do
if i mod 2 = 1 then
write (i,' ');
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,t:integer;
begin
clrscr;
readln(n);
for i:=1 to n do readln(a[i]);
t:=0;
for i:=1 to n do
if a[i]>0 then t:=t+a[i];
writeln(t);
readln;
end.
uses crt;
var n,i,s:integer;
begin
clrscr;
n:=1;
s:=0;
repeat
s:=s+n;
n:=n+1;
until s>1000;
writeln(n);
readln;
end.