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.
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.
c:
#include <bits/stdc++.h>
using namespace std;
long long a[1000],n,i;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++)
if (a[i]%2==0) cout<<a[i]<<" ";
return 0;
}
d:
#include <bits/stdc++.h>
using namespace std;
long long a[1000],n,i,nn;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
nn=a[1];
for (i=1; i<=n; i++) nn=min(nn,a[i]);
cout<<nn;
return 0;
}
a)
uses crt;
var n,i,kt,j:integer;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until n>1;
writeln('Cac so nguyen to be hon hoac bang ',n,' la: ');
for i:=2 to n do
begin
kt:=0;
for j:=2 to i-1 do
if i mod j=0 then kt:=1;
if kt=0 then write(i:4);
end;
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.
Câu 58:
Var n:integer;
Begin
Write('n = ');readln(n);
If n mod 2 <> 0 then write(n,' la so le')
Else write(n,' khong la so le');
Readln
End.
Câu 61:
Var n:integer;
Begin
Write('n = ');readln(n);
If n mod 2 = 0 then write(n,' la so chan')
Else write(n,' khong la so chan');
Readln
End.
program so_nguyen_to;
uses crt;
var i,n:integer;
function kt(n:integer):boolean;
var i,j:integer;
begin
j:=0;
for i:=1 to n do
if n mod i=0 then inc(j);
if j=2 then kt:=true
else kt:=false;
end;
BEGIN
clrscr;
write('nhap n:');readln(n);
if kt(n) then writeln(n,' la so nguyen to')
else writeln(n,' khong phai la so nguyen to');
writeln('cac so nguyen to be hon hoac bang ',n,' la:');
for i:=1 to n do
if kt(i) then write(i:5);
writeln;
writeln('cac cap so le lien tiep la so nguyen to be hon hoac bang ',n,' la:');
for i:=1 to n do
if (i mod 2=1) and (kt(i)) and (kt(i+2)) then write(i,',',i+2);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long n,i,x;
bool kt,kt1;
int main()
{
cin>>n;
kt=true;
for (i=2; i<=sqrt(n); i++)
if (n%i==0) kt=false;
if ((kt==true) and (n>1)) kt1=true;
else kt1=false;
if (n%2==0) kt1=true;
x=sqrt(n);
if (x*x==n) kt1=true;
if (kt1==true) cout<<"TRUE";
else cout<<"FALSE";
return 0;
}