Write a program that calculates the sum and product of 2, 4, 6, 8,..., n, where n is a user entered even integer value.
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Write a program that calculates the sum and product of 2, 4, 6, 8,..., n, where n is a user entered even integer value.
Write a program that calculates the sum and product of 2, 4, 6, 8,..., n, where n is a user entered even integer value. You will define two methods sumToN[int n) and productToN(int n) that calculate these two values. The following is a sample run: Enter a positive even number: 16 2+4+...+16 = 72 2*4*...*16= 10321920
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!