用while循环打印乘法9乘9表

来源:百度知道 编辑:UC知道 时间:2024/06/09 00:49:17

void main()
{
int i=1,j;
while(i<10)
for (j=i;j<10;j++)
cout<<i*j<<" ";
cout<<endl;
i++;
}

用什么编写说清楚了

public class TestTable
{
public static void main(String[] args)
{
int i= 1;
System.out.println(" Multiplication Table" );
System.out.println("------------------------------------");
System.out.print( " " + "|");
for( int k=1;k<=9;k++)
{
System.out.print( " " + i);
}
System.out.println();
while(i<=9 )
{

System.out.print(i+"|");
for ( int j=1;j<=9;j++)
{
if (i*j<10)
System.out.print(" "+i*j);
else
System.out.print(" "+i*j);
}
System.out.println();

i++;
}
}
}
这是用ja