当前位置:编程学习 > JAVA >>

九九乘法表


这要怎么写?
其他的三种都会了.. --------------------编程问答-------------------- 看不到图 --------------------编程问答-------------------- http://pic.wenwen.soso.com/p/20091015/20091015225830-716222769.jpg
图挂了.. --------------------编程问答-------------------- 从那个图来看楼主不是用C++做出来了吗
这种问题的解法都差不多 --------------------编程问答--------------------

public static void main(String[] args)
{
for(int i=1;i<10;i++)
{
for(int j=i;j<10;j++)
System.out.printf("%d*%d=%2d ",i,j,i*j);
System.out.println();
}
}
--------------------编程问答--------------------

public class MultiplicationTable {
public static void main(String[] args){
for(int i = 1; i <= 9; ++i){
for(int j = 1; j <= 9; ++j){
if(j >= i)
System.out.print(i + "*" + j + "=" + i*j + "  ");
}
System.out.println();
}
}

}


1*1=1  1*2=2  1*3=3  1*4=4  1*5=5  1*6=6  1*7=7  1*8=8  1*9=9  
2*2=4  2*3=6  2*4=8  2*5=10  2*6=12  2*7=14  2*8=16  2*9=18  
3*3=9  3*4=12  3*5=15  3*6=18  3*7=21  3*8=24  3*9=27  
4*4=16  4*5=20  4*6=24  4*7=28  4*8=32  4*9=36  
5*5=25  5*6=30  5*7=35  5*8=40  5*9=45  
6*6=36  6*7=42  6*8=48  6*9=54  
7*7=49  7*8=56  7*9=63  
8*8=64  8*9=72  
9*9=81  
--------------------编程问答--------------------
引用 5 楼 udbwcso 的回复:
Java code

public class MultiplicationTable {
    public static void main(String[] args){
        for(int i = 1; i <= 9; ++i){
            for(int j = 1; j <= 9; ++j){
                if(j >= i)
   ……

ding --------------------编程问答-------------------- class jiujiu
{
    public static void main(String[] args)
    {
        for (int i=1;i<10;i++)
        {
            for (int j=1;j<=i;j++)
            {
                System.out.print(j+"*"+i+"="+(j*i)+" ");
            }
            System.out.println();
        }
    }
}
绝对好使 --------------------编程问答-------------------- --------------------编程问答--------------------
class jiujiu
{
    public static void main(String[] args)
    {
        for (int i=1;i<10;i++)
        {
            for (int j=1;j<=i;j++)
            {
                System.out.print(j+"*"+i+"="+(j*i)+" ");
            }
            System.out.println();
        }
    }
} --------------------编程问答-------------------- 这好像不难嘛,好多地方都可以找到啊 --------------------编程问答-------------------- public class Test
{
public static void main(String[] args)
{
                for(int x =1;x<=9;x++)
        {
                         for(int y=1;y<=x;y++)
                 {
          System.out.print(y+"*"+x+"="+y*x+"\t");
         }
System.out.println();
}
}
}
--------------------编程问答-------------------- public class MultiplicationTable{
public static void main(String[] args){
for(int i=1;i<=9;i++){
for(int j=1;j<=i;j++){
System.out.print(i+"*"+j+"="+(i*j)+" ");
}
System.out.println();
}
}
} --------------------编程问答-------------------- 只需要三个循环就可以做到了 你自己试试吧 --------------------编程问答--------------------
public class AAAAA {
public static void main(String[] args) {
for(int i=1;i<=9;i++){
for(int j=i;j<=9;j++){
System.out.print(i+"*"+j+"="+i*j+" ");
}
System.out.println("");
}
}
}
补充:Java ,  Java SE
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,