Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
#include <iostream>
#include <math.h>
using namespace std;
int main() {
int n;
cin >> n;
if (sqrt(n)==round(sqrt(n))) cout << "yes";
else cout << "no";
}
Hãy giúp mọi người biết câu trả lời này thế nào?
"Số chính phương là một số nguyên dương bằng bình phương của một số nguyên dương."
=> Nếu `\floor{\sqrt{n}}^2 = n` thì `n` là số chính phương.
$\\$
Code tham khảo:
#include <iostream>
#include <math.h>
using namespace std;
int main() {
int n; cin >> n;
if ([](int x){return x*x;}(sqrt(n)) == n) cout << "yes";
else cout << "no";
}
$\\$
$\\$
$\color{#ffd710}{\texttt{\{}} \color{#8655d6}{\texttt{\{}}\ \ \color{#8cdcda}{\text{Daoanhviet96}}\ \ \color{#8655d6}{\texttt{\}}} \color{#ffd710}{\texttt{\}}}$
Hãy giúp mọi người biết câu trả lời này thế nào?
Bảng tin