Skip to content

Commit c9a0511

Browse files
committed
added: 6-abs.c
1 parent cfb5707 commit c9a0511

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

0x02-functions_nested_loops/6-abs.c

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* _abs - Computes the absolute a value of an integer.
3+
*
4+
* @n: the number to be processed.
5+
*
6+
* Return: absolute value of the integer.
7+
*/
8+
9+
int _abs(int n)
10+
{
11+
if (n < 0)
12+
{
13+
return (n * -1);
14+
}
15+
else
16+
{
17+
return (n);
18+
}
19+
}

0x02-functions_nested_loops/main.h

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ void print_alphabet_x10(void);
44
int _islower(int);
55
int _isalpha(int);
66
int print_sign(int);
7+
int _abs(int);

0 commit comments

Comments
 (0)