1068. Sum

I need to find the sum of all integer numbers lying between 1 and N inclusive and it seems that my program is wrong..

Input
The input consists of a single integer N that is not greater than 10000 by it's absolute value.
Output
Write a single integer number that is the sum of all integer numbers lying between 1 and N inclusive.

My program:
#include<iostream>
using namespace std;
int main()
{
int n,i,s;
cin>>n;
s=0;
for(i=1;i<=n;i++) s=s+i;
cout<<s;
return 0;
}

What makes you think it doesn't work?
Looks fine to me
Topic archived. No new replies allowed.