Question: Write a program that takes a positive whole number, n, and if n is even, performs the computation suggested by these examples, and prints the

Write a program that takes a positive whole number, n, and if n is even, performs the computation suggested by these examples, and prints the value of the computation. If n is odd, it prints nonsensical input.

input n computation output
4 (2/2)+(2+4)/4 2.5
6 (2/2)+(2+4)/4+(2+4+6)/6 4.5
8 (2/2)+(2+4)/4+(2+4+6)/6+(2+4+6+8)/8 7
3 nonsensical input

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!