Question 5. Visualizing identities
Write a program that with an input of a positive odd number (not more than 30) gives as output the visual representation of the sum of positive odd numbers up to the given number.
Observation: the formula for the sum of consecutive odd natural numbers is:
1 + 3 + 5 + ... + (2 p + 1) = p2 - see the image to understand why this is a visual “proof”.
For 1+3+5+7+9=25, the output should look similar to this :
color with the same color the disks belonging to the same number (see image for 1 + 3 + 5 = 32 )
Students succeed in their courses by connecting and communicating with an expert until they receive help on their questions
Consult our trusted tutors.