0
그래서 2 개 난수를 생성하고이를 곱해야하는 프로그램을 만드는 메신저 다릅니다두 사람은 난수를 생성하고 그들의 제품은
public static int thenumber(){
int number1=(int)(Math.random()*10+1);
return number1;
}
public static int thenumber2(){
int number2=(int)(Math.random()*10+1);
return number2;
}
을하고 그것을 해결 :
public static int thefusion(){
int demi =thenumber() * thenumber2();
return demi;
}
내 문제를 두 숫자의 제품을 실행할 때 다릅니다. 예 : 7 * 4 = 24
언어에 태그를 지정하십시오. – Bathsheba
죄송합니다. 내 실수로 (return numbers;)를 (return number1;)으로 바꿉니다. –
왜 'thenumber'와'thenumber2'가 필요한지 이해가 가지 않습니다. 두 가지 방법 모두 매우 똑같습니다. 그것은 당신이'System.out.println (thenumber()); System.out.println (thenumber2()); System.out.println (thefusion()); 메소드 호출과 난수 뒤에있는 개념을 이해 했습니까? – Jonathan