Question: C++ Write a for loop that will read a number and add all the integers from 1 to that number. For example, if the number
Write a for loop that will read a number and add all the integers from 1 to that number. For example, if the number is 5, it should add up 5+4+3+2+1 and sum should be 15. The input/output should be the following (the user input is in bold): 1. Please enter an integer: 7 The sum of 7 to l is: 28 Write a for loop that will take a base and an exponent and will write the result of base raised to the power of exponent. The input/output should be the following (note the user input is in bold): 2. Please enter base: 3 Please enter exponent: 4 The result is: 8 3. Re-write the exercise program using for loop. Ask the user to input the initial energy level. Each time a pushup being done the energy level goes down 2 units. Pushups can only be done when energy level greater than zero. Show the output how many pushups were done. The L/O should be the following (the user input is in bold): Please enter your level of energy (in mumber units): 10 You can perform 5 pushups Write a Bank-CD program that given the principal amount of deposit, number of years the money would be deposited and interest rate, will calculate the CD mature amount. The program will: 4. a. prompt for principal amount, number of years and interest rate. b. calculate the value of the CD at the end of its term write out the year number and the income generated by CD for that year. c. Principal: Interest Rate (%): Number of Years: 1000 5 3 Year Principal Interest Income Total Value 1000.00 1050.00 52.50 1102.5055.13 50.00 1050.00 1102.50 1157.63
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
