java九九乘法表編程代碼?
package text;
public class TEST{
public static void main(String[] args) {
for (int i = 1; i <=9; i++) {
for (int j = 1; j <= i; j++) {
System.out.print(j+"*"+i+"="+(i*j)+" ");
}System.out.println( );
}
}
}
擴展資料:
用其他的方法輸出九九乘法表:
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
int i, j ;
for (i = 1; i < 10;i++)
{
for (j = 1; j <= i; j++)
printf("%d*%d = %-3d", i, j, i*j);
printf("\n");
}
system("pause");
return0;
}