Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära Challenge: Signal | Bitwise Operators and Shifts
Bitwise Operations and Binary Logic in C

bookChallenge: Signal

Uppgift

Swipe to start coding

You are working with signal strength values and need to adjust them using bitwise operations. Implement two functions:

  • int increaseSignal(int value): increases the signal by shifting the value left by 1 bit;
  • int decreaseSignal(int value): decreases the signal by shifting the value right by 1 bit.

Follow these rules:

  • Use only the bitwise shift operators (<< and >>);
  • Do not use multiplication (*) or division (/);
  • Return the updated value from each function.

Lösning

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 2. Kapitel 3
single

single

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

close

bookChallenge: Signal

Svep för att visa menyn

Uppgift

Swipe to start coding

You are working with signal strength values and need to adjust them using bitwise operations. Implement two functions:

  • int increaseSignal(int value): increases the signal by shifting the value left by 1 bit;
  • int decreaseSignal(int value): decreases the signal by shifting the value right by 1 bit.

Follow these rules:

  • Use only the bitwise shift operators (<< and >>);
  • Do not use multiplication (*) or division (/);
  • Return the updated value from each function.

Lösning

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 2. Kapitel 3
single

single

some-alt