数组元素的产物 [英] Product of arrays elements

查看:74
本文介绍了数组元素的产物的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试学习java,我书中的一个问题是计算数组中元素的乘积,我不明白产品在这个上下文中的意思是什么,有人可以解释一下给我使用任何类型的数据列表(例如1,2,3,1,2,3)



书中的问题。

使用下面给出的数据列表来初始化数组,编写程序来解决问题

计算数组中元素的乘积;

使用数据列表: 2,4,6,9,5,4,5,7,12,15,21,32,45,5,6,7,12。

I am currently trying to learn java and 1 of the questions in my book is to "Compute the product of the elements in the array", I don't understand what the term product mean in this context,can someone explain this to me using any type of data list (example 1,2,3,1,2,3)

The Question in the book.
Using the data list given below to initialise an array, write programs to solve the problem
Compute the product of the elements in the array;
using the data list: 2, 4, 6, 9, 5, 4, 5, 7, 12, 15, 21, 32, 45, 5, 6, 7, 12.

推荐答案

谢谢你的澄清。如果这是本书的精确引用,我不会喜欢这样的书。您总是可以尝试找到一本更准确地制定练习的书。



无论如何,看起来问题需要找到所有数字的产品。给定列表,如2 * 4 * 6 * 8 ... * 7 * 12.当然,这些数字不应该是硬编码的,而是从列表中获取,无论列表中数据的当前内容是什么。



-SA
Thank you for clarification. If this is a precise quote from the book, I would not like such a book. You can always try to find a book where the exercises are formulated more accurately.

Anyway, it looks like the problem requires to find the product of all the numbers in the given list, like 2 * 4 * 6 * 8 ... * 7 * 12. Of course, these numbers should not be hard-coded, but takes from the list, no matter what the current content of the data in the list is.

—SA


这篇关于数组元素的产物的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆