this program is trying to add from 1.. to x with return function.
but when I enter 10 sum is 54 which is wrong. 1,2,3,4,5,6,7,8,9,10 = 55
#include <cstdlib>
#include <iostream>
int burcin(int);
using namespace std;
int main(int argc, char *argv[])
{
int x;
int ft=0;
cout << "enter the number=\n";
cin >> x;
ft=+burcin(x);
cout << "from 1"<<"to"<<x<<"\ntotal value="<<ft<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
int burcin(int x)
{
if (x==1) return 0;
else
return (x+ burcin(x-1));
}