Hello, i searched the forums but couldn't find my answer.
I have a code already made that finds the cube of all numbers from 0-30.
I was given the code and told to make it only odd numbers instead of all numbers from 0-30.
I was given the code and told to make it only odd numbers instead of all numbers from 0-30.
Just so I'm clear, you mean that this new program is to only find the cube of odd numbers? Change your for loop to iterate over odd numbers only (ie, starting at one and incrementing by two for each iteration of the loop).
I believe you would change the numb=0 to numb=1, and change the numb++ meaning keep adding 1 to numb+2 or numb++2 but as I am relatively new to programming there's a good chance I am wrong and apologize if so.
I should have mentioned this, my bad. But i did that.
The real problem for me is getting to start at 0 and doing all odd numbers till 30 (Or 29 in this case)