For your homework, write a program that outputs all the multiples of three less than or equal to a given number. Use a scanner to input the given number.
import java.util.Scanner;class Main {public static void main(String[] args) { Scanner sc = new Scanner(system.in);int number = sc.nextln;for (int i = 1, i => number, i = i + 3); System.out.nextln(i*3); }}
import java.util.Scanner;class Main {public static void main(String[] args) { Scanner in = new Scanner(System.in);int number = in.nextInt();int actualNumber;for (int i = 3; i <= number; i = i + 3) System.out.println(i); }}
import java.util.Scanner;class Main {public static void main(String[] args) { Scanner in = new Scanner(System.in);int number = in.nextInt();int actualNumber;for (int i = 3; i <= number; i = i + 3) System.out.println(i); }}
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(system.in); int number = sc.nextln; for (int i = 1, i => number, i = i + 3); System.out.nextln(i*3); } }
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int number = in.nextInt(); int actualNumber; for (int i = 3; i <= number; i = i + 3) System.out.println(i); } }
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("The maximum is: "); int num = sc.nextInt(); System.out.println("The numbers are: "); for (int i = 3; i <= num; i= i+3) System.out.println(i); } }
import java.util.Scanner;
public class HW {
public HW() {
// TODO Auto-generated constructor stub
}
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.print("Enter the number: ");
Scanner in = new Scanner(System.in);
int number = Integer.parseInt(in.next());
in.close();
System.out.println("All positive numbers which are multiples of 3 and are less than " + number + ": \n");
for (int i = number; i > 0; i -= 3) {
System.out.print(i + " ");
}
}
}
import java.util.*;
public class Multiples {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
for(int i = 1; i <= (a/3); i++ ){
System.out.println(i * 3);
}
}
}
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int number = in.nextInt(); int actualNumber; for (int i = 3; i <= number; i = i + 3) System.out.println(i); } }