Answer to Question #289763 in Java | JSP | JSF for Kish

Question #289763

The first line of the input consists of an integer numOfProducts, representing the number of products to be considered in the sales data (N).




The second line consists of N space separated characters - productID₁, productID 2...... productIDN representing the product IDs of the sales of the last N products.

1
Expert's answer
2022-01-22T16:33:52-0500
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        String[] ids = new String[n];
        for (int i = 0; i < n; i++) {
            ids[i] = in.next();
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS