+ 1

the product of odd number from 0-20

am having a serious issue om how to write that instruction using

10th Apr 2019, 12:11 AM
Isaac Love
Isaac Love - avatar
3 Antworten
+ 4
Okay so you seem to be asking for the pseudocode: 0) set a variable "product" to 1 1) Iterate through 1 and 20 2) See if the number is not divisible by 2 3) If yes, multiply product by that number. 4) Print out the product.
10th Apr 2019, 1:28 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
Another way would be to just set a for loop starting at 1 to iterate through every number until 20 with a step of 2 🤷‍♂️ for i in range(1,20,2): prod*=i
10th Apr 2019, 1:49 AM
Faisal
Faisal - avatar
0
i appreciate you guys thanks
10th Apr 2019, 3:42 AM
Isaac Love
Isaac Love - avatar