Write a program that uses a for statement to sum a sequence of integers. Assume that the first integer read specifies the number of values remaining to be entered. Your program should read only one value per input statement. A typical input sequence might be
5 100 200 300 400 500
where the 5 indicates that the subsequent 5 values are to be summed.

#include <iostream>
using namespace std;
int main()
    int x,sum=0,y,n;
    cout<<" Please enter your assumed integer: ";
    cout<<" Numbers: ";

    for (y=1;y<=x;y++)

    cout<<" Sum = "<<sum<<endl;
    return 0;


when I debug the program it repeats numbers word three times and I don't know what is the problem..

This question has already been answered. Start a new discussion instead.