This code is supposed to find the remainder of a very large number, then show the number that was divided by the very large number. (only if the remainder is equal to 0)
#include < iostream>
usingnamespace std;
//Foward Decalration of function that will find the remainder of two values
longlongint findRemainder(longlongint x, longlongint y)
{
return x % y;
}
int main()
{
longlongint longNumber = 600851475143;
longlongint y;
int result = findRemainder(longNumber, y);
for(y = 2; result != 0; y++);
{
findRemainder(longNumber, y);
}
cout << y;
cin.get();
return 0;
}
I suspect that it might have to do with the integer 'y'. (I think I initialized it to 2, then initialized it again to 2 in the for loop. Warnings come up, but they go away as soon as the console window opens. Can anyone fix this?
Thanks!
EDIT: I just noticed that 'int result' is not a long long integer, so I have changed that.