Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I really need help with this. it\'s confusing to me write a C++ program which an

ID: 3782157 • Letter: I

Question


I really need help with this. it's confusing to me

write a C++ program which answers the following question: How tar do you have to go in adding together the sequence 1+2+3+4+5+6 for the sum to exceed 25,00o? That is, your program should keep adding together the above nunber sequence until the sun gets to be nore than 25,000 at which point it should print out both the sun an d the last number added which nade the sum go over 25,000. Please print out appropriate nessages with each of these, like: The last number added was The final s was Note that since you have seen in class an easy way of adding arithmetic series, you can actually check the coaputer work by hand here (Sonething to think about what might you do to convince yourself of your program's correctness if you didn't know how to sum up arithnetic series?) Please hand in a paper copy of your c++ source cade progran not the compiler listing) and a copy of yo There are several ur output possible ways of getting a printout of your output (depending on the environment in which you are working such as screen dumping logging the session sending output directly to a printer and writing output to a file for later printing As this is your first assignment and as the output is not voluminous you can just copy the output hand onto a sheet of paper and hand that in along with your source code

Explanation / Answer

#include<iostream.h>

using namespace std;

int main()

{

int sum=0;

int i=1;

while(sum<=25000)

{

sum=sum+i;

i++;

}

cout<<"The last number added is"<<sum-i;

cout<<"The final sum is"<<sum;

return 0;

}