-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_power.c
More file actions
22 lines (20 loc) · 1.04 KB
/
Copy pathft_power.c
File metadata and controls
22 lines (20 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_pwer.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mnishimo <mnishimo@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/28 22:29:37 by mnishimo #+# #+# */
/* Updated: 2019/01/12 22:30:27 by mnishimo ### ########.fr */
/* */
/* ************************************************************************** */
#include "libftprintf.h"
int ft_power(int base, int power)
{
if (power == 0)
return (1);
if (power < 0)
return (1);
return (base * ft_power(base, power - 1));
}