26 lines
1.0 KiB
C
26 lines
1.0 KiB
C
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* ft_power.c :+: :+: :+: */
|
||
|
/* +:+ +:+ +:+ */
|
||
|
/* By: gbrochar <marvin@42.fr> +#+ +:+ +#+ */
|
||
|
/* +#+#+#+#+#+ +#+ */
|
||
|
/* Created: 2015/12/05 15:23:07 by gbrochar #+# #+# */
|
||
|
/* Updated: 2015/12/07 11:03:41 by gbrochar ### ########.fr */
|
||
|
/* */
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
#include "libft.h"
|
||
|
|
||
|
int ft_power(int nb, int pow)
|
||
|
{
|
||
|
int ret;
|
||
|
|
||
|
ret = 1;
|
||
|
if (pow < 0)
|
||
|
return (-1);
|
||
|
while (pow--)
|
||
|
ret *= nb;
|
||
|
return (ret);
|
||
|
}
|