Python 99 multiplication table is printed from four different directions: this is done with a while loop, which is a must for a double loop .
# lower left corner 99 multiplication table:
I=1
While I < 10:
J=1
While J <= I:
Print ("%d*%d=%2d"% (j,i,i*j), end= "") # control the format of the output
J+=1
I+=1
Print () # prints a line to wrap
# top left 99 multiplication table:
I=9
While i > 0:
J=1
While J <= I:
Print ("%d*%d=%2d"% (j, I, I * j), end= "")
J+=1
I-=1
Print ()
Print ("--------------------------------------------------------------------")
# Right bottom 99 multiplication table:
I=1
While I < 10:
K=9
While K >= I:
Print ("", End= "") # to squeeze the output format to the right, here we use a space to squeeze the contents of the output but note the alignment of the format
K-=1
J=1
While J <= I:
Print ("%d*%d=%2d"% (j, I, I * j), end= "")
J+=1
I+=1
Print ()
Print ("-----------------------------------------------------------------------")
# top right 99 multiplication table:
I=9
While i > 0:
K=1
While K <= 10-i:
Print ("", end= "")
K+=1
J=1
While J <= I:
Print ("%d*%d=%2d"% (j, I, I * j), end= "")
J+=1
I-=1
Print ()
Python 99 multiplication table while looping print