Joined
Last Seen
0 Reputation Points
Unknown Quality Score
No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
0 Endorsements
Ranked #107.55K
1 Posted Topic
Re: [code=c]#include<stdio.h> #define N 8 int main() { int a[N]={0,1,1,1,1,1,1,1}; int b[N]={0,1,1,1,1,1,1,1}; int sum[N + 1]={0}; int carry=0,i; for(i=N-1;i>=0;i--) { sum[i+1]=a[i] ^ b[i] ^ carry; carry=(a[i] & b[i]) + (carry*(a[i] ^ b[i])); } sum[0]=carry; printf(" a: "); for(i=0;i<N;i++) { printf("%d ",a[i]); } printf("\n b: "); for(i=0;i<N;i++) { printf("%d ",b[i]); } printf("\nsum: … |
The End.