lord@rabbit-3 ~ % gain
win x war = enigma
549 x 537 = 294813, gain = 8349
program gain
implicit none
integer w,i,n,a,r,e,ee,g,m,war,win,enigma,dum,dum1,en(6)
do 1 w=0,9
do 2 i=0,9
if(i.eq.w) go to 2
do 3 n=0,9
if(n.eq.i.or.n.eq.w) go to 3
do 4 a=0,9
if(a.eq.n.or.a.eq.i.or.a.eq.w) go to 4
do 5 r=0,9
if(r.eq.a.or.r.eq.n.or.r.eq.i.or.r.eq.w) go to 5
win=100*w+10*i+n
war=100*w+10*a+r
enigma = win * war
dum=enigma
do ee=6,1,-1
dum1=(dum/10 *10)
en(ee)=dum-dum1
dum=dum1/10
enddo
if(en(2).ne.n.or.en(3).ne.i.or.en(6).ne.a)go to 5
e=en(1)
if(e.eq.w.or.e.eq.i.or.e.eq.n.or.e.eq.a.or.e.eq.r)
1 go to 5
g=en(4)
if(g.eq.w.or.g.eq.i.or.g.eq.n.or.g.eq.a.or.g.eq.r
1 .or.g.eq.e) go to 5
m=en(5)
if(m.eq.w.or.m.eq.i.or.m.eq.n.or.m.eq.a.or.m.eq.r
1 .or.m.eq.e.or.m.eq.g) go to 5
print 777,win,war,enigma,g,a,i,n
777 format('win x war = enigma',/,
1 i3,' x ',i3,' = ',i6,', gain = ',4i1)
5 enddo
4 enddo
3 enddo
2 enddo
1 enddo
end
Edited on July 8, 2020, 8:01 pm