Hello all,
I need to write a function to find the greatest divisor of a number besides itself. I can't understand why what I have written isn't working.
Any help would be great. Here it is.... (year is the number)
[code]
int third (int year, int i)
{
int largestdivisor;
for (i = year; i >= 0; i--)
{
if (year%i == 0)
break;
}
largestdivisor = year/i;
return largestdivisor;
}
[/code]
An error msg comes up saying "too few arguments to function `int third(int, int)"
Comments
:
: I need to write a function to find the greatest divisor of a number
: besides itself. I can't understand why what I have written isn't
: working.
: Any help would be great. Here it is.... (year is the number)
:
: [code]:
: int third (int year, int i)
: {
: int largestdivisor;
: for (i = year; i >= 0; i--)
: {
: if (year%i == 0)
: break;
: }
: largestdivisor = year/i;
: return largestdivisor;
: }
: [/code]:
:
: An error msg comes up saying "too few arguments to function `int
: third(int, int)"
Don't worry, i figured it out.