-
Notifications
You must be signed in to change notification settings - Fork 1
/
ft_pow.c
22 lines (20 loc) · 1 KB
/
ft_pow.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_pow.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vbrazas <vbrazas@student.unit.ua> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/11/18 15:22:05 by vbrazas #+# #+# */
/* Updated: 2018/08/04 16:26:32 by vbrazas ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
ssize_t ft_pow(ssize_t n, int pw)
{
if (n <= 0 || pw <= 0)
return (0);
while (--pw)
n *= n;
return (n);
}