ft_pow.c 1015 B

1234567891011121314151617181920212223242526
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* ft_pow.c :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: bchanot <bchanot@student.42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2018/09/26 00:42:52 by bchanot #+# #+# */
  9. /* Updated: 2018/10/11 22:58:05 by bchanot ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #include "libft.h"
  13. size_t ft_pow(int a, int b)
  14. {
  15. size_t r;
  16. r = 1;
  17. while (b > 0)
  18. {
  19. r *= a;
  20. b--;
  21. }
  22. return (r);
  23. }