Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Question5 {
- public static void main(String[] args) {
- // 1과 10000사이의 3의 배수와 5의 배수를 출력하는데 한 줄에 10개씩 출력하고 마지막에는 3의 배수와 5의 배수의 개수와 합을 출력하는 프로그램
- /*
- * 입력 : 없음
- * 출력1 : 3의 배수 (10개씩)
- * 출력2 : 5의 배수 (10개씩)
- * 출력3 : 3의 배수 개수와 5의 배수의 개수 & 합
- */
- int MAX = 10000;
- for(int i = 1; i <= MAX; i++) {
- i = i + 2;
- System.out.print(i + " ");
- if(i % 30 == 0) {
- System.out.println();
- }
- }
- System.out.println();
- for(int j = 1; j <= MAX; j++) {
- j = j + 4;
- System.out.print(j + " ");
- if(j % 50 == 0) {
- System.out.println();
- }
- }
- int k;
- k = 10000 / 3;
- System.out.println("Multiple Numbers [3] : " + k);
- int l;
- l = 10000 / 5;
- System.out.println("Multiple Numbers [5] : " + l);
- System.out.println("Total Multiple Numbers [3 & 5] : " + (k + l));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement