Recap - Product Array
Part of the Fundamentals section of Coddy's GDScript journey. Lesson 66 of 92.
Challenge
EasyThe program reads a count, then that many whole numbers, one per line, and stores them in the array numbers. This part is already written.
Print the product of all the numbers in numbers: every number multiplied together. For the input below, the output is 6, because 1 * 2 * 3 is 6.
3
1
2
3Try it yourself
extends Node
func _ready():
var count := int(OS.read_string_from_stdin())
var numbers := []
for i in range(count):
numbers.append(int(OS.read_string_from_stdin()))
# Write your code below
All lessons in Fundamentals
4Operators Part 1
Arithmetic OperatorsInteger DivisionModulo OperatorArithmetic ShortcutsRecap - Simple MathComparison Operators10Functions
Declare a FunctionArgumentsReturnReturn TypesRecap - Sigma FunctionRecap - Validation FunctionDefault Values5Operators Part 2
Logical Operators Part 1Logical Operators Part 2Recap - Simple LogicLogical Operators Part 3Ternary OperatorPractice on your own: Online GDScript compiler