Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 5 rem moltiplicazioni in multiprecisione by felice nardella
- 10 printchr$(147)chr$(5)" moltiplicazioni in multiprecisione"
- 15 print:print"primo fattore (min 5 cifre e max 8)":inputn1
- 20 print:print"secondo fattore (min 5 cifre e max 8)":inputn2
- 25 a$=str$(n1):b$=str$(n2)
- 30 c1=len(a$):c2=len(b$)
- 35 ifc1<6orc2<6orc1>9orc2>9goto15
- 40 i1=c1-4:i2=c2-4
- 45 x(0)=val(right$(a$,4))
- 50 x(1)=val(left$(a$,i1))
- 55 y(0)=val(right$(b$,4))
- 60 y(1)=val(left$(b$,i2))
- 65 ifx(0)=0andn(0)=0goto170
- 70 ifx(0)=0thenx(0)=x(1):x(1)=0
- 75 ify(0)=0theny(0)=y(1):y(1)=0
- 80 c(0)=x(0)*y(0)
- 85 c(1)=x(0)*y(1)+x(1)*y(0)
- 90 c(2)=x(1)*y(1)
- 95 c0$=str$(c(0)):r0$=right$(c0$,4):iflen(r0$)=2thenr0$="000"+r0$
- 100 iflen(r0$)=3thenr0$="00"+r0$
- 105 iflen(r0$)=4andleft$(r0$,1)=" "thenr0$="0"+r0$
- 110 c0=len(c0$):i0=c0-4:ifi0>0thenl0$=left$(c0$,i0)
- 115 ifi0<=0thenl0$=""
- 120 c(1)=c(1)+val(l0$)
- 125 c1$=str$(c(1)):r1$=right$(c1$,4)
- 130 c1=len(c1$):i1=c1-4:ifi1>0thenl1$=left$(c1$,i1)
- 135 ifi1<=0thenl1$=""
- 140 c(2)=c(2)+val(l1$):c2$=str$(c(2)):ifc(2)=0thenc2$=""
- 145 ifc(2)<>0andlen(r1$)=2thenr1$="000"+r1$:goto160
- 150 ifc(2)<>0andlen(r1$)=3thenr1$="00"+r1$:goto160
- 155 ifc(2)<>0andlen(r1$)=4andleft$(r1$,1)=" "thenr1$="0"+r1$
- 160 gosub175:ifx(1)=0ory(1)=0thenr0$=r0$+"0000"
- 165 printc2$r1$r0$:goto180
- 170 gosub175:r=x(1)*y(1):r$=str$(r):printr$"00000000":goto180
- 175 print:print"il prodotto di"n1"*"n2"e':":return
- 180 print:print"vuoi continuare? (s/n)"
- 185 getv$:ifv$=""goto185
- 190 ifv$<>"s"thenend
- 195 clr:goto15
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement