我似乎有我需要的代碼,我可以得到正確的輸出。所以我出38隨機數,但需要把它們放入七行我相信我解決了正確的編碼使用的答案然而它不是正確投放或我會在這裏得到錯誤是我的代碼想要一些請協助。需要幫助,使我的輸出成行和列
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));
}
}
}
不知道如何使它正確輸出。非常感謝你。更容易。我很喜歡這樣做,並沒有編碼一段時間。它確實有效。非常感謝您的幫助。 – user1657240
很高興我可以幫助,不要忘記接受; D – arshajii