Question: Write code to allow the user to enter a positive integer. Compute and display the sum of the odd integers from 1 to the entered
Write code to allow the user to enter a positive integer. Compute and display the sum of the odd integers from to the entered integer, including the entered integer if it is odd.
For example, if the user enters then is computed.
If the user enters then is computed.
For example:
Input Result
Enter an integer:
Sum of the odds is
Enter an integer:
Sum of the odds is
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
