Jump to content

operadores e expressões

Recommended Posts

Agradecia ajuda na resolução deste exercício.

int x=2

int y=3

int a=x&y

começando a resolver manualmente,

2:2=1/ 0

1:2=0 /1

binário (de 2)=10

3:2=1/ 1

1:2=0/ 1

binário (de 3)=11

Assim, int a= 10&11 que é equivalente a (1&1)(0&1) que é igual a 10(binário)

Como é que eu faço a passagem de (1&1)(0&1) =10(binário) ?

Share on other sites

tens de saber as tabelas de verdade :

``` op(e)             op(ou)
a b | a&b         a b | a|b
---------         ---------
0 0 |  0          0 0 |  0
0 1 |  0          0 1 |  1
1 0 |  0          1 0 |  1
1 1 |  1          1 1 |  1
```
 IRC : sim, é algo que ainda existe >> #p@p

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×

• Revista PROGRAMAR

• Wiki
• IRC
×
• Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.