Write a program that prompts for an integer-lets call it


Sum of consecutive integers

A) Write a program that prompts for an integer-let's call it X-and then finds the sum of X consecutive integers starting at 1. That is, if X = 5, you will find the sum of1+2+3+4+5=15

B) Modifyyourprogrambyenclosingyourloopinanotherloopsothatyoucanfind consecutive sums. For example, if 5 is entered, you will find five sums of consecutive numbers:
1=1

1+2=3
1+2+3 = 6 1+2+3+4 = 10 1+2+3+4+5 = 15

Print only each sum, not the arithmetic expression.

C) Modify your program again to only print sums if the sum is divisible by the number of operands. For example, with the sum 1 + 2 + 3 + 4 + 5 = 15, there are five operands and the sum, 15, is divisible by 5, so that sum will be printed. (Do you notice a pattern?)

1=1
1+2+3=6

1+2+3+4+5=15

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a program that prompts for an integer-lets call it
Reference No:- TGS02931639

Expected delivery within 24 Hours