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.
const
fi='sochinhphuong.inp';
fo='sochinhphuong.out';
var f,g:text;n:longint;
function scp(n:longint):boolean;
begin
if (sqr(trunc(sqrt(n)))=n) then exit (true);
exit (false);
end;
begin
assign(f,fi);reset(f);
assign(g,fo);rewrite(g);
readln(f,n);
if scp(n) then writeln(g,'yes') else
writeln(g,'no');
close(f);close(g);
end.
{PROGRAM bai_tap;
USES crt ;
VAR i , n, t:integer;
BEGIN
clrscr;
Write('Nhap n');Readln(n);
t:=0;
For i:=1 to n-1 do
if n mod i=0 then t:=t+i;
if t=n then write(n,' la so hoan chinh');
else Writeln(n,' Khong la so hoan chinh');
Readlnnline Pascal Compiler.
begin
End,
Readlnnline
END.
}
#include <bits/stdc++.h>
using namespace std;
long long n,i,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=n/2; i++)
if (n%i==0) t=t+i;
if (t==n) cout<<"YES";
else cout<<"NO";
return 0;
}
var x, i : integer;
begin
writeln('nhap so nguyen x : ')
read(x);
if ( x < 2) then writeln(' x khong phai so nguyen to');
else if ( x > 2) then
begin
for i := 2 to ( x - 1) do
begin
if ( x mod i = 0) then writeln(' x khong la so nguyen to');
end;
end;
else
writeln(' x la so nguyen to');
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long n;
//chuongtrinhcon
bool ktnt(long long n)
{
if (n<2) return(false);
else
for (int i=2; i*i<=n;i++)
if (n%i==0) return (false);
return(true);
}
//chuongtrinhchinh
int main()
{
//freopen("KTSNT.INP","r",stdin);
//freopen("KTSNT.OUT","w",stdout);
cin>>n;
if (ktnt(n)==true) cout<<"1";
else cout<<"0";
return 0;
}
Var n,i,souoc:integer;
Begin
Write('Nhap N = ');readln(n);
souoc:=0;
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.
program KiemTraSoNguyenTo;
var
N, i: integer;
IsPrime: boolean;
begin
write('Nhap N: ');
readln(N);
IsPrime := true;
if (N < 2) then
IsPrime := false
else
for i := 2 to trunc(sqrt(N)) do
if (N mod i = 0) then
begin
IsPrime := false;
break;
end;
if IsPrime then
writeln(N, ' la so nguyen to')
else
writeln(N, ' khong la so nguyen to');
readln;
end.
program tim_uoc;
uses crt;
var n,i,j:longint;
begin
clrscr;
write('nhap so n:');readln(n);
write('cac uoc cua n la:');
for i:=1 to n do
if n mod i=0 then write(i:3);
writeln;
j:=0;
for i:=1 to n do
if n mod i=0 then j:=j+1;
if j=2 then writeln(n,' la so nguyen to')
else writeln(n,' khong phai la so nguyen to');
readln;
end.
2:
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,i,kt=0;
cin>>n;
for (int i=2; i*i<=n; i++)
if (n%i==0) kt=1;
if (kt==0) cout<<"YES";
else cout<<"NO";
}
program ct;
uses crt;
var dem,n,s,max,t:longint;
begin
writeln('nhap n:');readln(n);
while n>0 do begin
s:=n mod 10;
t:=t+s;
if max<s then max:=s;
dem:=dem+1;
n:=n div 10;
end;
writeln('tong la',t,',','co',' ',dem,' ','chu so',',','chu so lon nhat la:',max);
readln
end.
bạn xem lại nha mik làm đây nhưng k bt đk
Cau 1:
Câu 2:
#include <bits/stdc++.h>
using namespace std;
long long n;
int main()
{
cin>>n;
if (n>0 && n%5==0) cout<<"Phai";
else cout<<"Khong phai";
}