Question: Phython Should you square a number, or cube it? Well, if you input an integer that is even, then you should print out every square
Phython
Should you square a number, or cube it? Well, if you input an integer that is even, then you should print out every square of an integer value that is less than the input squared. If you input an integer that is odd, you should print out all cube values that are less than the cube of it. Since there is no limit to how much less than the input value a negative number will be, you cannot print out the cubes of negative odd integers and should print "Invalid Input" if someone gives you a negative odd number.
Constraints cube value of input will be less than 2^30 so no overflow occurs.
Output Format output the results on a separate line for each answer. If sample input is the number 5, you should output 1 8 27 64 Sample Input 0 5 Sample Output 0 1 8 27 64 Explanation 0 These are the cube values less than 5, not including 0 cubed. Sample Input 1 6 Sample Output 1 1 4 9 16 25 Explanation 1 These are the square values less than 6 squared.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
