Advertisement
redsees

Untitled

Feb 12th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int i,z;
  7.     for(i=0;i<4;i++)
  8.     {
  9.     for(z=0;z<4;z++)
  10.     {
  11.     short int a=i,b=z;
  12.     short int R;
  13.     short int B0 = b&1;     //B0 = LSB of variable b
  14.     short int B1 = (b&2)>>1;    //B1 = second LSB of variable b
  15.     short int A0 = a&1;     //A0 = LSB of variable a
  16.     short int A1 = (a&2)>>1;    //A1 = second LSB of variable a
  17.     R = (B0&A0)|(((B0&A1)^(B1&A0))<<1)|(((B1&A1)^((B0&A1)&(B1&A0)))<<2)|(((B1&A1)&(B0&A1)&(B1&A0))<<3);
  18.     printf("A = %d B = %d Result = %d\n\n",a,b,R);
  19.     }}
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement