Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- int main()
- {
- int i,z;
- for(i=0;i<4;i++)
- {
- for(z=0;z<4;z++)
- {
- short int a=i,b=z;
- short int R;
- short int B0 = b&1; //B0 = LSB of variable b
- short int B1 = (b&2)>>1; //B1 = second LSB of variable b
- short int A0 = a&1; //A0 = LSB of variable a
- short int A1 = (a&2)>>1; //A1 = second LSB of variable a
- R = (B0&A0)|(((B0&A1)^(B1&A0))<<1)|(((B1&A1)^((B0&A1)&(B1&A0)))<<2)|(((B1&A1)&(B0&A1)&(B1&A0))<<3);
- printf("A = %d B = %d Result = %d\n\n",a,b,R);
- }}
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement