我似乎有我需要的代码,我可以正确地输出。所以我要放 38 个随机数,但需要将它们放入 7 行中请帮忙。
import java.util.Scanner;
public class OneCounter2{
public static void main(String args[]){
Scanner input = new Scanner( System.in );
System.out.println(" Product 2: Tires");
System.out.println(" Random numbers between 1 and 3800 are,");
for ( int row = 0 ; row < 5 ; row++ )
{
// PRINT a row
for ( int col = 0 ; col < 7 ; col++ )
}
for(int i=0; i < 38 ; i++)
{
System.out.print( "*" ) ;
}
// PRINT newline
System.out.println( "" ) ;
System.out.println(" Random Numbers ["+ (i+1) + "] : " + (int)(Math.random()*3800));
}
}
}