function lab0_coa
a=input('enter a:');
b=input('enter b:');
c=input('enter c:');
for i=4:-1:1
sum=xor(xor(a(1,i),b(1,i)),c);
carry=or(and(a(1,i),b(1,i)),and(xor(a(1,i),b(1,i)),c));
c=carry;
result(1,i)=sum;
end
disp(result);
disp(c);
end
0 comments:
Post a Comment