Homework 12

·  ·  Write a program that asks the user for a value (double) for x.   The program should then ask the user for a value (integer) for N that is greater than or equal to three.  As long as the user provides an invalid N, continue to ask until he provides a valid N. Once a correct N is provided, use a for loop to calculate the sum below and then print the answer.

Hint: Google “cplusplus.com pow()” for details on how to raise x to the power k.

Here is a sample run:

TURN-IN: Your source code and a screenshot showing your program running with x = 3.5, and where the users enters n=1, then n=-2, then n=5 (as in the above screenshot).