15,881,248 members
1.00/5 (1 vote)
See more:
If “number” is an even number, store the binary representation in the right order.
If “number” is an odd number, store the binary representation in the reverse order

What I have tried:

include <stdio.h>
int main() {
int num;
printf("Enter an integer: ");
scanf("%d", &num);

// true if num is perfectly divisible by 2
if(num % 2 == 0)
printf("%d is even.", num);
else
printf("%d is odd.", num);

return 0;
}
Posted
Updated 9-Oct-22 9:11am
merano99 9-Oct-22 16:18pm
There is a source code approach, but no question?
You can already see if the number is even or odd, only the two functions that do the conversion are missing. It would also be nice if you could make the source code easier to read with the appropriate code tags.

## Solution 1

While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]