function num=major_check(num1,num2,num3)

s1=sign(num1);
s2=sign(num2);
s3=sign(num3);
c1=dec2bin(abs(num1));
c2=dec2bin(abs(num2));
c3=dec2bin(abs(num3));
for i=1:length(c1)
        if (c1(i)~=c2(i) & c1(i)~=c3(i)) 
            c1(i)=c2(i);
        end
end
s=s1;
if (s1~=s2 & s1~=s3)
    s=s2;
end
num=s*bin2dec(c1);