Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1.  
  2. int log(int base, int m)
  3. {
  4. int res = 0;
  5. int _m = base;
  6. if ((m == 0) || (base == 0) || (base == 1))
  7. return res;
  8. while (_m <= m)
  9. {
  10. _m = _m * base;
  11. res += 1;
  12. };
  13. return res;
  14. };
  15.  
  16. int main() {
  17. int base, m, result;
  18. in(base);
  19. in(m) ;
  20. result = log(base, m);
  21. out(result)
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement