fork download
  1. #include<stdbool.h>
  2. #include<stdio.h>
  3.  
  4. void toboolean(int x1)
  5. {
  6. while(x1>0)
  7. {
  8. printf("%d",x1%2);
  9. x1=x1/2;
  10. }
  11. printf("\n");
  12. }
  13. bool oppositeSigns(int x, int y)
  14. {
  15. //toboolean(x^y);
  16. //toboolean(x);
  17. toboolean(y);
  18. return ((x ^ y) < 0);
  19. }
  20.  
  21. int main()
  22. {
  23. int x = 10, y = -10;
  24. if (oppositeSigns(x, y) == true)
  25. printf ("Signs are opposite");
  26. else
  27. printf ("Signs are not opposite");
  28. return 0;
  29. }
  30.  
Success #stdin #stdout 0s 10320KB
stdin
Standard input is empty
stdout
Signs are opposite