package com.zuoye.test;//控制台输出九九乘法表public class Jiujiu { public static void main(String[] args) { int i; int j; int sum; for(i=1;i<10;i++) { for(j=1;j<=i;j++) { sum=i*j; System.out.print(i+"*"+j+"="+sum+"\t");//空格 } Sys…
1.打印在左上角 #直角在左上方 for i in range(9,0,-1): for j in range(1,10): if j <= i: print("{}*{}={}".format(i,j,i*j),end="\t") print() 预览: 2.打印在左下角 #直角在左下方 for i in range(1,10): for j in range(1,10): if j <= i: print("{}*{}={}".f…
#九九乘法表 for...in .. #左下角 for i in range(1,10): for j in range(1,i+1): print(' %d×%d=%2d'%(j,i,i*j), end = '') print() print('-------------------------------------------------------------------------') #右下角 for i in range(1,10): for k in range(i,9): pr…
运用for....in...遍历的四种方向的九九乘法表: 左下角: import sysfor i in range(1,10): for j in range(1,i+1): sys.stdout.write("%d*%d=%2d "%(i,j,i*j)) print(" ") 运行结果如下: 左上角: import sysfor i in range(9,0,-1): for j in range(1,i+1): sys.stdout.write("%…