public class Test { public static void main(String args[]) { int c = 0; for(int a=1; a<10; a++) { for(int b=1; b <= a; b++) { System.out.print(a +"x"+ b +"="+ a*b+" "); if(a == b) { System.out.println(); } } } } }刚打的
public class Test { public static void main(String args[]) { //int c = 0; 把这句删掉,不删也可以运行,不过还是删了,这个变量多余的 for(int a=1; a<10; a++) { for(int b=1; b <= a; b++) { System.out.print(a +"x"+ b +"="+ a*b+" "); if(a == b) { System.out.println(); } } } } } 晕了 上面 INT C = 0;这行忘了删了。
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(""); } } }
虽然LS给出了参考 LZ最好还是自己动手做一下吧 这样对你有好处
import java.util.*; public class control7 { public static void main(String[] args) { int[] a={1,2,3,4,5,6,7,8,9}; for(int i=0;i<a.length;i++) { for(int j=0;j<i+1;j++) System.out.print(a[i]+"*"+a[j]+"="+a[i]*a[j]+" "); System.out.println(); } } }
//也可以不用数组的 public class control7 { public static void main(String[] args) { for(int x=1;x<10;x++) { for(int y=1;y<x+1;y++) { System.out.print(x+"*"+y+"="+(x*y)+" "); if(x==y) { System.out.println (); } } } } }
大家好如果要编成倒过来形式怎么编: 输出结果为: 9*9=81 9*8=72.。。 8*8=64. public class jiujiu { public static void main(String[] args) { int a; int b; for (a = 9; a >= 1; a--) { for (b=9; b<=a &&b>=1; b--) { System.out.print(b + "*" + a + "=" + a*b+" "); if(b==1){ System.out.println("");} } } } } 这个程序为啥不能循环,奇怪的
private static void jiujiu() { for (int i = 1; i < 10; i++) { for (int j = 1; j <= i; j++) { System.out.print(i+"*"+j+"="+i*j+"\t"); } System.out.println(); } }
public class Demo { public static void main(String []args) { int i; int j; for (i=1, j=1; j<=9; i++) { System.out.print(i+ "*" +j+ "=" +i*j+ " "); if (i == j) { i = 0; j++; System.out.println(); } } } }
楼主【Calvin_Lee】截止到2008-07-14 15:55:59的历史汇总数据(不包括此帖):
发帖的总数量:0 发帖的总分数:0 每贴平均分数:0
回帖的总数量:0 得分贴总数量:0 回帖的得分率:0%
结贴的总数量:0 结贴的总分数:0
无满意结贴数:0 无满意结贴分:0
未结的帖子数:0 未结的总分数:0
结贴的百分比:---------------------结分的百分比:---------------------
无满意结贴率:---------------------无满意结分率:---------------------
如何结贴请参考这里:http://topic.csdn.net/u/20080501/09/ef7ba1b3-6466-49f6-9d92-36fe6d471dd1.html
public static void main(String args[]) {
int c = 0;
for(int a=1; a<10; a++) {
for(int b=1; b <= a; b++) {
System.out.print(a +"x"+ b +"="+ a*b+" ");
if(a == b) {
System.out.println();
}
}
}
}
}刚打的
public static void main(String args[]) {
//int c = 0; 把这句删掉,不删也可以运行,不过还是删了,这个变量多余的
for(int a=1; a<10; a++) {
for(int b=1; b <= a; b++) {
System.out.print(a +"x"+ b +"="+ a*b+" ");
if(a == b) {
System.out.println();
}
}
}
}
}
晕了 上面 INT C = 0;这行忘了删了。
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("");
}
}
}
LZ最好还是自己动手做一下吧
这样对你有好处
{
public static void main(String[] args)
{
int[] a={1,2,3,4,5,6,7,8,9};
for(int i=0;i<a.length;i++)
{
for(int j=0;j<i+1;j++)
System.out.print(a[i]+"*"+a[j]+"="+a[i]*a[j]+" ");
System.out.println();
}
}
}
public class control7
{
public static void main(String[] args)
{
for(int x=1;x<10;x++)
{
for(int y=1;y<x+1;y++)
{
System.out.print(x+"*"+y+"="+(x*y)+" ");
if(x==y)
{
System.out.println ();
}
}
}
}
}
输出结果为:
9*9=81 9*8=72.。。
8*8=64.
public class jiujiu
{
public static void main(String[] args)
{
int a; int b;
for (a = 9; a >= 1; a--)
{
for (b=9; b<=a &&b>=1; b--)
{
System.out.print(b + "*" + a + "=" + a*b+" ");
if(b==1){ System.out.println("");}
}
}
}
}
这个程序为啥不能循环,奇怪的
{
for (int i = 1; i < 10; i++) {
for (int j = 1; j <= i; j++) {
System.out.print(i+"*"+j+"="+i*j+"\t");
}
System.out.println();
}
}
{
public static void main(String []args)
{
int i;
int j;
for (i=1, j=1; j<=9; i++)
{
System.out.print(i+ "*" +j+ "=" +i*j+ " ");
if (i == j)
{
i = 0;
j++;
System.out.println();
}
}
}
}