fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. double a;
  5. cin >> a;
  6. if (a == 0) {
  7. cout << 0;
  8. }
  9. else if ((int(a)%2)!= 0 and a!=0) {
  10. cout << -1;
  11. }
  12. else if (int(a) % 2 == 0 and a != 0) {
  13. cout << 1;
  14. }
  15. return 0;
  16. }
Success #stdin #stdout 0.01s 5292KB
stdin
3.999
stdout
-1