Skip to content

TRUEANGLE

BEAUTY AND PLAY

  • DOLLECT
  • Others
  • Configuration
  • AI
  • BLOG
  • ABOUT
    • ABOUT
    • Perception Style

Daily Archives: July 25, 2014

How to write an algorithm to detect if two integers have opposite signs ?

/* detect if two integers have opposite signs */ #include <stdio.h> int x , y; typedef int bool; bool f; int sdetect(x , y) { f = ((x ^ y) < 0); if ( f == 1 ) { printf(“They have opposite signs\n”); } else { printf(“They have same signs\n”); } }

Posted byjeffrinJuly 25, 2014Posted inC, computer science, Programming LanguagesTags: algorithm
July 2014
M T W T F S S
 123456
78910111213
14151617181920
21222324252627
28293031  
« Jun   Aug »
TRUEANGLE, Proudly powered by WordPress.