복습 한번 써본거
package practice;
public class practice {
public static void main(String[] args) {
int n = 26;//
int q = n/10;
int r = n%2;//짝수면 되므로 ex)26%2 = 0 그냥 나머지가 2로나눴을때로 판단
if(q%2==0) {
if(r%2==0) {
System.out.println("우동");
}else {
System.out.println("탕수육");
}
}else {
if(r%2==0) {
System.out.println("짜장");
}else {
System.out.println("짬뽕");
}
}
}
}
package practice;
import java.util.Random;
public class practice {
public static void main(String[] args) {
int s = 0;
for (int i = 0; i < 10; i++) {
int rn = (new Random().nextInt(5));
System.out.println(rn);
s = s +rn;
}
System.out.println(s);
}
}
728x90
댓글