liked sepp2k responce ...
the statement you have says "program"
"Write a program that calculates N!/K! for given N and K (1<N<K)."
so i think it implies more then just the simple subroutines that you have that are one method (could be enough for C-) and but don't show enought i think ...
but i was looking at it differently and have noted some missing points
first you have not proved the values are within specs asked for
for given N and K (1<N<K)."
second your use of double seems you automatic use it but may not understand its implications .... because you failed to make the value i a double
which means that it will cause error before it can reach the N or K value if they are larger then the interger max size
and what if the values of N & K being larger then the double max size
also your test sample is simple but i hope you expand to show the specs ...
ie what if you did (6,5) what would happen ... or (-5 * 10 ** 4 , 5 * 10 ** 100)
its the black box testing that will show that you understand the proccess and not just clone book examples ...
our main problem will be that we don't know at what level of math & programing you are doing this at ... there are many ways to approch this ...
double result = 1;
for (int i = 1; i <= x; i++)
result *= i;
return result;
if ( x > 1 )
return x * fact( x - 1 )
else
return double(1)