Computer Science, asked by Cosmicexplorer2950, 9 months ago

What do you mean by publishing a presentation write the steps to publish the representation named practice. pptx saved on the desktop

Answers

Answered by aka757489
0

Explanation:

I'm trying to Write the main method of a Java program that has the user enter two integers, i and n. If either integer is less than 2, output “Please enter numbers above 1.” Otherwise, output the n positive multiples of i, separated by spaces.

I'm close but can't figure out how to do display the multiples.

Here's what a sample run should look like:

Enter i: 4

Enter n: 6

6 multiples of 4 are: 8 12 16 20 24 28

import java.util.*;

public class HW5Problem3 {

public static void main (String [] args) {

int i = 0;

int n = 0;

Scanner input = new Scanner(System.in);

System.out.print("Enter i: ");

i = input.nextInt();

System.out.print("Enter n: ");

n = input.nextInt();

if ((i <= 1) || (n <= 1)) {

System.out.println("Please enter numbers above 1");

System.exit(1);

}

System.out.print(n + " multiples of " + i + " are: ");

}

}

Similar questions