answersLogoWhite

0

#include <stdio.h>

#include <iomanip>

int main()

{

int binary1[8] = {0,1,1,1,1,0,1,1}; //8 element array

int binary2[8] = {1,0,1,0,1,1,1,1}; //8 element array

int binarySum[9];

int overflow [9];

int i;

for (i=0; i<9; i++) overflow[i] = 0;

for (i=9; i >= 0; i--)

{

binarySum[i] = binary1[i] + binary2[i] + overflow[i];

if ( binarySum[i] > 1)

{

overflow[i-1] = 1;

binarySum[i] %= 2;

}

}

printf("Binary Sum is: ");

for (i = 0; i<9; i++) printf("%i", binarySum[i]);

printf("\n");

printf("\n");

printf("Carry Bit is: ");

for (i = 8 ; i>=0 ; i--) printf("%i", overflow[i]);

printf("\n");

return (0);

}

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

How do you write 0 in binary numbers?

0.


How do you write the number 212 in binary numbers?

212 (decimal) is 11010100 (binary)


How do you write a c program to convert binary to decimal by using while statement?

write a c++ program to convert binary number to decimal number by using while statement


Write a program of binary heap in c or c language?

to implement operations on binary heap in c


What is the difference of binary and decimal numbers?

-- The decimal system (base-10) uses 10 digits to write all numbers. -- The binary system (base-2) uses 2 digits to write all numbers.


How do you write binary numbers as a decimal?

Kick yourself in the bum first


Write a C program that takes a binary file as input and finds error check using different mechanisms?

write a c program that takes a binary file as input and finds error check using different mechanisms.


How do you write the number 212 in binary numbers or any other number?

110101002


Write a program in Lex to eliminate white space and collect numbers as a token?

write a lex program to delete space from the program


How do you write an assembly language program to find the sum of n numbers using array?

write an assembly language program to find sum of N numbers


Write a c program for matrix addition using function?

#include&lt;


What is the associate property of addition?

I think it would mean like this:3*(5+6)=33 Not sure though you out!* * * * *Totally irrelevant answer.The associative property of addition states that you can carry out the binary operation of addition in any order. That is to say, for any three numbers a, b and c:(a + b) + c = a + (b + c) and so you can, without ambiguity, write either as a + b + c.Multiplication is also an associative binary operation.