i am doing a question where i have to get answer in modulo 10^9+7
Blockquote
for(j=0;j<5;j++)
{
num=num*i;
i--;
}
cout<<num<<endl;
return (num/120)%mod;
But the problem is that the value of num exceeds 10^9+7 and i am able to apply mod only after the whole loop is executed ie (return (num/120)%mod)