Question: MultiplyGiven an Array of int called arr, and an int sizewith the number of elements in the array, write code that will calculate the product

MultiplyGiven an Array of int called arr, and an int sizewith the number of elements in the array, write code that will calculate the product of its elements.
After your calculation, print the following: "The product is: "+ result
Make sure to close the Scanner named in at the end of main()
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.util.Scanner;
public class CodingQuestion {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int size = in.nextInt();
int[] arr = new int[size];
for (int i =0; i < size; i++){
arr[i]= in.nextInt();
}
// WRITE YOUR CODE HERE
}// end of main()
}
STDOUT
Expected STDOUT
Theproductis:6000

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!