-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_power.c
More file actions
27 lines (25 loc) · 1.13 KB
/
ft_power.c
File metadata and controls
27 lines (25 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* ************************************************************************** */
/* LE - / */
/* / */
/* ft_power.c .:: .:/ . .:: */
/* +:+:+ +: +: +:+:+ */
/* By: rcabotia <marvin@le-101.fr> +:+ +: +: +:+ */
/* #+# #+ #+ #+# */
/* Created: 2018/10/10 11:23:58 by rcabotia #+# ## ## #+# */
/* Updated: 2018/10/10 11:25:20 by rcabotia ### #+. /#+ ###.fr */
/* / */
/* / */
/* ************************************************************************** */
#include "libft.h"
int ft_power(int nb, int power)
{
if (power >= 0)
{
if (power == 0)
return (1);
else
return (nb * ft_power(nb, power - 1));
}
else
return (0);
}