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 TimBoi4ChuSo;
var
n, i: integer;
begin
repeat
writeln('Nhap vao so nguyen n (2<n<100): ');
readln(n);
until (n > 2) and (n < 100);
writeln('Cac boi cua ', n, ' co 4 chu so la: ');
for i := 1000 to 9999 do
begin
if i mod n = 0 then
writeln(i);
end;
end.
uses crt;
var i,n,kt:integer;
begin
clrscr;
readln(n);
kt:=0;
for i=2 to trunc(sqrt(n)) do
if n mod i=0 then kt:=1;
if (kt=0) and (n>1) then write('phai')
else write('Khong phai');
readln;
end.
Var i,n,souoc:integer;
Begin
While n <= 1 do
Begin
Write('Nhap n = ');readln(n);
End;
For i:=1 to n do
If n mod i = 0 then souoc:=souoc+1;
If souoc = 2 then write(n,' la so nguyen to')
Else write(n,' khong la so nguyen to');
Readln;
End.
uses crt;
var a,t,i:integer;
begin
clrscr;
t:=0;
for i:=1 to 6 do
begin
readln(a);
if (a mod 2=0) then t:=t+a;
end;
writeln(t);
readln;
end.
program bai_1;
uses crt;
var i,n,j,d,dem:word;
begin
clrscr;
repeat
write('nhap n:');readln(n);
if (n<=0)or(n>=10000)then writeln('so ban nhap khong hop le, ban hay nhap lai:');
until (n>0)and(n<10000);
writeln('cac uoc so la so tu nhien cua ',n,' la:');
for i:=1 to n do
if n mod i=0 then write(i,' ');
writeln;
dem:=0;
for i:=2 to n do
begin
d:=0;
for j:=2 to i div 2 do
if i mod j=0 then inc(d);
if (d=0)and(n mod i=0)then inc(dem);
end;
if dem>0 then writeln('cac uoc so la so nguyen to cua ',n,' la:');
begin
d:=0;
for j:=2 to i div 2 do
if i mod j=0 then inc(d);
if (d=0)and(n mod i=0)then write(i,' ');
end;
if dem=0 then write(0);
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.
#include <bits/stdc++.h>
using namespace std;
int n,kt,t;
int main()
{
cin>>n;
int t=0;
for (int i=1; i<=n; i++)
if (i%2==1) cout<<i<<" ";
cout<<endl;
for (int i=2; i<=n; i++)
{
kt=0;
for (int j=2; j*j<=i; j++)
if (i%j==0) kt=1;
if (kt==0) cout<<i<<" ";
}
return 0;
}
1:
#include <bits/stdc++.h>
using namespace std;
long long dem,i,n,x;
int main()
{
cin>>n;
dem=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x%2==0) dem++;
}
cout<<dem;
return 0;
}
Câu 2:
#include <bits/stdc++.h>
using namespace std;
long long x,n,i,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x%3==0) t+=x;
}
cout<<t;
return 0;
}
program MultiplesOfN;
var
n, i: integer;
begin
repeat
write('Nhap vao so nguyen duong n (0<n<100): ');
readln(n);
until (n > 0) and (n < 100);
writeln('Cac boi so cua ', n, ' co 4 chu so la:');
for i := 1000 to 9999 do
begin
if (i mod n = 0) then
begin
writeln(i);
end;
end;
readln;
end.
em cảm ơn nhé ạ