-
Notifications
You must be signed in to change notification settings - Fork 1
/
ft_fcd.c
24 lines (22 loc) · 1.04 KB
/
ft_fcd.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_fcd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vbrazas <vbrazas@student.unit.ua> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/11/18 18:08:19 by vbrazas #+# #+# */
/* Updated: 2017/11/18 18:09:15 by vbrazas ### ########.fr */
/* */
/* ************************************************************************** */
int ft_fcd(int a, int b)
{
int i;
if (a <= 0 || b <= 0)
return (0);
i = (a >= b) ? a : b;
while (--i)
if ((a % i) == 0 && (b % i) == 0)
return (i);
return (1);
}