public static void main(String args[]){
int doubleNumber = 0;
int singleNumber = 0;
int i =1;
while(i <= 50){
if(i %2==0){
doubleNumber+=i;
}else{
singNumber+=i;
}
i++;
}
System.out.println(doubeNumber);
System.out.println(singleNumber);
}
时间: 2024-10-08 04:27:54