Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a="+-----------------CALCULATOR----------------------+"
- local xa=a
- rednet.send(RAM,"CLEAR")
- rednet.send(RAM,a)
- a=" "
- rednet.send(RAM,a)
- a="+ or - * or / ?"
- rednet.send(RAM,"write")
- rednet.send(RAM,a)
- rednet.send(RAM,"INPUT")
- local it,ot=rednet.receive()
- if it==RAM then
- if ot=="+" then
- x=1
- end
- if ot=="-" then
- x=2
- end
- if ot=="*" then
- x=3
- end
- if ot=="/" then
- x=4
- end
- end
- rednet.send(RAM,"CLEAR")
- rednet.send(RAM,xa)
- rednet.send(RAM," ")
- rednet.send(RAM,"write")
- rednet.send(RAM,"First Number: ")
- rednet.send(RAM,"INPUT")
- local zt, tz=rednet.receive()
- if zt==RAM then
- F=tz
- end
- rednet.send(RAM,"CLEAR")
- rednet.send(RAM,xa)
- rednet.send(RAM," ")
- rednet.send(RAM,"write")
- rednet.send(RAM,"Second Number: ")
- rednet.send(RAM,"INPUT")
- local zt, tz=rednet.receive()
- if zt==RAM then
- S=tz
- end
- if x==1 then
- E=F+S
- end
- if x==2 then
- E=F-S
- end
- if x==3 then
- E=F*S
- end
- if x==4 then
- E=F/S
- end
- rednet.send(RAM,"CLEAR")
- rednet.send(RAM,xa)
- rednet.send(RAM," ")
- rednet.send(RAM,"write")
- rednet.send(RAM,"RESULT: ")
- rednet.send(RAM,E)
- rednet.send(RAM," ")
- rednet.send(RAM,"PULL")
- local ui=0
- while ui==0 do
- uu,ut=rednet.receive()
- if uu==RAM then
- if ut=="PULLED" then
- ui=1
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment