다른 while 루프의 변수를 사용하여 print 문에 삽입하는 방법은 무엇입니까?두 개의 다른 while 루프의 변수 사용
public class Squares{
public static void main (String [] args){
int counterA = 0;
int counterB= 0;
while (counterA<51){
counterA++;
if (counterA % 5 == 0){
int one = (counterA*counterA);
}
}
while (counterB<101){
counterB++;
if (counterB % 2 == 0){
int two = (counterB*counterB);
}
}
System.out.println(one+two);
}
}
무엇 내가 몇 – jenncar
를 받고되어야 할 때 나는 단지 하나 개의 라인을 얻을 너 정말로하려고? 문제 진술서를 게시 하시겠습니까? –
인쇄 명령문은 한 번만 실행됩니다. 루프 안에서 움직이는 것을 고려하십시오. – Zavior