Advertisement
Vaskor096

Big mod

Nov 13th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.15 KB | None | 0 0
  1. int bmod(int a,int b,int m)
  2. {
  3. if(b==0)
  4. return 1;
  5. int x=bmod(a,b/2,m);
  6. x=(x*x)%m;
  7. if(b%2==1)
  8. x=(x*a)%m;
  9. return x;
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement