Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program setbit.c that accepts two integer arguments s and p. If s is equ

ID: 3620511 • Letter: W

Question

Write a program setbit.c that accepts two integer arguments s and p.
If s is equal to 1, it sets all the bits of an integer to 1 except for the p-th bit. If s is
equal to 0, it sets all the bits of an integer to 0 except for the p-th bit. Here is the
sample output.
./ setbit 1 0
11111111111111111111111111111110
./ setbit 0 0
00000000000000000000000000000001
./ setbit 0 10
00000000000000000000010000000000
./ setbit 1 10
11111111111111111111101111111111

P.S you don't have to attach any program, just copy and past the C++ program. I'll run it by my own.

Explanation / Answer

please rate - thanks
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote