Bitwise Operators Assignment Due 7 November 2005

ECCP practical assignment 5-1:

Write a program which will ask the user for a number between -128 and 127. The program will then convert the number to binary and display the result. The program will also calculate the number's one's complement and its two's complement and display them.

The output screen should look like this after the program has run:

Enter a number between -128 and +127: 26
  The number 26 in decimal equals 0001 1010 binary
    Its one's complement is 1110 0101
    Its two's complement is 1110 0110
Hints:

ECCP practical assignment 5-2:

Write a program that converts a binary number to decimal.

The program prompts the user to enter eight ones or zeros and the program calculates and prints the decimal equivalent.

Type in an eight bit binary number: 01010101
    01010101 = 85 decimal