I'm trying to add all the square root answer but why am i getting this output: -858993430
#include <iostream.h>
void main()
{
int input;
int sqrt;
int i, sum, add;
cout << "Please enter your desire number: ";
cin >> input;
for (i=1; i <= input; i++)
{
sqrt = i * i;
add = sqrt;
cout << i << "^2 = " << sqrt<< "\n";
sum += add;
}
cout << "the sum is: " << sum;
}
what could be wrong? hope you could help me with this. thanks!