Advertisement
Guest User

xor

a guest
Oct 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.31 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4.  
  5. {
  6.  
  7.     int ara[] = { 12345 , 2 , 3 , 4 , 12345 , 2 , 3 } ;
  8.  
  9.     int result , i , n = 7 , p ;
  10.  
  11.     result = ara[0] ;
  12.  
  13.     for( i = 1 ; i < n ; i++ )  {
  14.  
  15.         p = result ;
  16.  
  17.         result = result ^ ara[i] ;
  18.  
  19.         printf("%d = %d ^ %d\n",result,p,ara[i]) ;
  20.  
  21.     }
  22.  
  23.     printf("result : %d\n",result) ;
  24.  
  25.     return 0 ;
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement