=my_script.m RUN Vars [1x4] - out 1 2 3 [1x4] [1x4] 11 12 %commulative law %commulative law function test=my_script p=input("enter values of p: "); q=input("enter values of g: "); %function to find allp function output1=commulativel(p, q) output1=q1p; end %function to find q&p function output2=commulative2(P,9) output2=9&p; end % first finding plla x=pla % first finding p&q y=p&q output1=commulativel(p,q) output2=commulative2(,9) if(x==output1 && y=-output2) display("commulative law is proved") end end 16 18 octave: 12> my_script([0 0 1 1], [O 1 0 1]) enter values of p: > [0 0 1 1] enter values of q: > [0 1 0 1] X = 0 1 1 1 y = 0001 output1 = 1 1 1 output2 = 0001 commulative law is proved
#ans 2 %DISTRIBUTIVE LAW %DISTRIBUTIVE LAW function test=my_script() p=input("enter values of p: "); q=input("enter values of q: "); r=input("enter values of r: "); %function to find (p&q)|(p&r) function output1=commulativel(p,q,r) output1=(p&q) (p&r); end %function to find (19)&(pr) function output2=commulative2(p,q,r) output2=(p19)&(pr); end % first finding p&(q|r) x=p&(ar) % first finding pl(q&r) y= pl(q&r) output1=commulativel(p,q,r) output2=commulative2(p,q,r) if(x==output1 && y=-output2) display("Distributive law is proved") end end 16 17 18 19 20 octave:4> my_script() enter values of p: > [000011 1 1] enter values of q: > [001100 1 1] enter values of r: > [0 10 10 10 1] X = 0 0 0 0 0 1 1 1 y = 0 0 0 1 1 1 1 1 output1 = 0 0 0 0 0 1 1 1 output2 = 0 0 0 1 1 1 1 1 Distributive law is proved
# ans 1 2 00 OU 10 %De Morgan's LAW %De Morgan's LAW function test=my_script() p=input("enter values of p: "); q=input("enter values of q: "); %function to find mpa function output1-commulative1(,9) output1=wp ~; end %function to find wp&nq function output 2-commulative2(p, q) output2=wp&mq; end % first finding ~(p&q) X=n(p&q) % first finding (pla) y=n(pl) output1=commulativel(p, q) output2=commulative2(P,9) if(x==output1 && y=-output2) display("De Morgan's law is proved") end end 13 14 15 16 17 18 octave:7> my_script() enter values of p: > [0 0 1 1] enter values of q: > [O 1 0 1] X = 1 1 1 0 y = 1 000 output1 = 1 1 1 0 output2 = 1 000 De Morgan's law is proved