Write a program that calculates the sum and product of 2, 4, 6, 8,..., n, where n is a user entered even integer value.
Posted: Thu May 05, 2022 1:19 pm
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