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

the question is: sum of numbers write a program that asks the user for a positiv

ID: 3609513 • Letter: T

Question

the question is: sum of numbers write a program that asks the user for a positive value. Theprogram should use a loop to get the sum of all the intergers from1 to the number entered. For example, if the user enters 50, theloop will find the sum of 1, 2, 3, 4, ....50. do not accept an input that is less then 1. i think i should use a for loop for this program. i believe i have to use a counter, but i dont know how to sumup the numbers in the counter. i have something like this so far... int n;        // number theuser enters count = 0; int sum = count + n; for (count < n; count++) cout << " The sum is " << sum <<endl;
i dont know if the sum = count + n will work or not.... I really just dont know how to sum up the numbers in the count, andif the user entered a 0 for n would the relational statement,0<0, be true or false? thankyou the question is: sum of numbers write a program that asks the user for a positive value. Theprogram should use a loop to get the sum of all the intergers from1 to the number entered. For example, if the user enters 50, theloop will find the sum of 1, 2, 3, 4, ....50. do not accept an input that is less then 1. i think i should use a for loop for this program. i believe i have to use a counter, but i dont know how to sumup the numbers in the counter. i have something like this so far... int n;        // number theuser enters count = 0; int sum = count + n; for (count < n; count++) cout << " The sum is " << sum <<endl;
i dont know if the sum = count + n will work or not.... I really just dont know how to sum up the numbers in the count, andif the user entered a 0 for n would the relational statement,0<0, be true or false? thankyou

Explanation / Answer

please rate - thanks here's a solution #include int main() {int i,sum=0,n=-5; while(n