[algogeeks] sum of two n bit binary intergers

2011-05-31 Thread D.N.Vishwakarma@IITR
There are two n length array A[1...n] ,B[1...n] in which n-bit binary integers are stored... We have to sum these two integers and store it in n+1 length array C[1...n+1] in binary form -- **With Regards Deoki Nandan Vishwakarma IITR MCA Mathematics Department* * -- You received this message

Re: [algogeeks] sum of two n bit binary intergers

2011-05-31 Thread Vishal Thanki
#include stdio.h int main() { int a[8] = {1,0,1,1,0,0,1,1}; int b[8] = {1,0,1,1,0,0,1,1}; int c[9] = {0}; int size = sizeof(a)/sizeof(a[0]); int i; int carry = 0; for (i = size-1; i = 0; i--) { if (a[i] b[i]) {