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.
Bài 1:
Program HOC24;
uses crt;
var n: integer;
begin
clrscr;
write('Nhap N: '); readln(n);
if n mod 2 = 0 then write(n,' la so chan') else write(n,' la so le');
readln;
end.
Bài 2:
Program HOC24;
uses crt;
var n: integer;
begin
clrscr;
write('Nhap N: '); readln(n);
if n = sqr(trunc(sqrt(n))) then write(n,' la so chinh phuong') else (n,' khong phai la so chinh phuong');
readln;
end.
uses crt;
var n:integer;
begin
clrscr;
readln(n);
if trunc(sqrt(n))=sqrt(n) then writeln('yes')
else writeln('no');
readln;
end.
uses crt;
var a:array[1..100] of integer;
i,n,ln:integer;
begin
clrscr;
readln(n);
for i:=1 to n do
readln(a[i]);
ln:=0;
for i:=1 to n do
if trunc(sqrt(A[i]))=sqrt(a[i]) then
begin
write(a[i]:4);
if ln<A[i] then ln:=A[i];
end;
writeln;
writeln('So chinh phuong lon nhat la: ',ln);
readln;
end.
uses crt;
var i,n,dem:integer;
begin
clrscr;
readln(n);
dem:=0;
i:=1;
while i<=n do
begin
if trunc(sqrt(i))=sqrt(i) then begin inc(dem); write(i:4);
end;
i:=i+1;
end;
writeln;
writeln(dem);
readln;
end.
uses crt;
var n:integer;
begin
clrscr;
repeat
write('Nhap n='); readln(n);
until n>0;
if sqrt(n)=trunc(sqrt(n)) then writeln(n,' la so chinh phuong')
else writeln(n,' khong la so chinh phuong');
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long a[1000],i,n,x;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
sort(a+1,a+n+1);
for (i=1; i<=n; i++)
{
int x=sqrt(a[i]);
if (x*x==a[i])
{
cout<<x;
return 0;
}
}
cout<<"Ko co so chinh phuong trong day";
return 0;
}
uses crt;
var x,i,max,n,dem,dem1,dem2,dem3,t,t1:integer;
a,b,c,d,e:array[-32000..32000]of integer;
tbca,tbcd:real;
begin
clrscr;
write(‘n=’); readln(n);
for i:=1 to n do
begin
write(‘a[‘,i,’]=’); readln(a[i]);
inc(b[a[i]]);
end;
{———————————-cau-a—————————-}
max:=0;
for i:=1 to n do
if max<b[a[i]] then
begin
max:=b[a[i]];
x:=a[i];
end;
writeln(‘phan tu co so lan xuat hien nhieu nhat trong mang la: ‘,x);
{——————————–cau-b——————————-}
dem:=0;
for i:=1 to n do
if a[i]>=0 then
begin
dem:=dem+1;
c[dem]:=a[i];
end;
dem1:=0;
for i:=1 to dem do
if trunc(sqrt(c[i]))=sqrt(c[i]) then inc(dem1);
writeln(‘so luong so chinh phuong trong day la: ‘,dem1);
{——————————–cau-c—————————–}
dem2:=0;
dem3:=0;
for i:=1 to n do
begin
if a[i]>0 then
begin
inc(dem2);
d[dem2]:=a[i];
end;
if a[i]<0 then
begin
inc(dem3);
e[dem3]:=a[i];
end;
end;
t:=0;
t1:=0;
for i:=1 to dem2 do
t:=t+d[i];
tbcd:=t/dem2;
for i:=1 to dem3 do
t1:=t1+e[i];
tbca:=t1/dem3;
writeln(‘trung binh cong cac so am la: ‘,tbca:4:2);
writeln(‘trung binh cong cac so duong la: ‘,tbcd:4:2);
readln;
end.
Nghĩa là sao bạn nhỉ? bạn giải thích rõ cho mình về số trùng phương nhé