fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int32_t main() {
  5. int N;
  6. cin >> N;
  7.  
  8. double X = sqrt(N); // sqrt la can 2
  9. if(int(X) == X) {
  10. cout << "N la so chinh phuong\n";
  11. } else cout << "N khong la so chinh phuong\n";
  12.  
  13. int x = int(X);
  14. if(x * x == N) {
  15. cout << "N la so chinh phuong\n";
  16. } else cout << "N khong la so chinh phuong\n";
  17.  
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
N khong la so chinh phuong
N khong la so chinh phuong