24May/10Off
Array Arrays
Array Arrays

How do I multiply numbers inside of an integer array in JAVA?
For example, if the array was
int [] array = {1, 2, 3, 4};
You would do 1 *2 * 3 * 4 = 24
Can I plz have a code snippet for this?
firstly u need to get the input from the user
use a for loop to find the total
class ex{
public static void main(String args[])
{
DataInputStream in =new DataInputStream(System.in);
int array[]=new int[10];
for(int i=0;i<10;i++)
{
System.out.println("Enter the number:");
array[i]=Integer.parseInt(in.readLine());
}
int tot=1;
for(int i=0;i<10;i++)
tot=tot*array[i];
System.out.println(tot);
}
}
![]() |
5 New Bose Acoustimass Double Cube Horizontal Cube Speakers Black w Cables | US $300.00 | 1h 1m |
![]() |
Bose Lifestyle 35 5 Channel Home Theater System with DVD Player | US $710.00 | 3h 14m |
![]() |
ZAON PCAS XRX | US $636.00 | 3h 42m |
![]() |
MORNINGSTAR SUNSAVER 15A 12V SOLAR PANEL CHARGE CONTROLLER TRAKSTAR SS MPPT 15L | US $80.95 | 5h 59m |
![]() |
Iron Man Xbox 360 2008 | US $2.01 | 14h 28m |
![]() |
Iron Man Xbox 360 2008 Used | US $10.00 | 21h 52m |
![]() |
New Pro Dual User Fir Belt LCD Ionic Detox Ion Foot Bath Spa Cleanse Machine | US $127.50 | 1d 1h 39m |
![]() |
Raymarine E120 W Touchscreen Multifunction Display | US $1,375.00 | 3d 15h 10m |
![]() |
Zaon XRX Collision Avoidance System PCAS | US $760.00 | 3d 19h 45m |
![]() |
Lot of 4 911EP LumiLeds Red LED Arrays 3 Leds on each Array USED | US $19.99 | 4d 13h 2m |
![]() |
JBL VRX932LA 1 Main Stereo Speakers Set of 4 | US $3,500.00 | 4d 17h 11m |
![]() |
QLOGIC QL2562 PCIex8 2 port 8 Gbps Fibre Channel Adapter | US $249.00 | 4d 20h 2m |
![]() |
Vintage Speakers Isophon Western Germany Mid Tweeter Set of 2 Excellent Used | US $9.99 | 4d 23h 45m |
![]() |
Rocket RAID 2314 4 External eSATA SATA II PCI e RAID Controller | US $1.00 | 6d 15h 21m |
![]() |
NEW 2U Supermicro X8DTE F 2x Intel E5645 24Ghz 6 Core 192GB RAM Database Server | US $5,695.00 | 7d 13m |














