Skip to content

Commit

Permalink
5-sign.c
Browse files Browse the repository at this point in the history
  • Loading branch information
victorpreston committed Jun 20, 2023
1 parent 20ba2d4 commit a18c009
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions 0x02-functions_nested_loops/5-sign.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# include "main.h"
/**
* print_sign-check the sign of a number.
*
* @n:Number whose sign is to be checked.
* Return:1-if n is greater than 0: 0- if n equals 0:-1-if n is less than 0
*/



int print_sign(int n)
{
if (n > 0)
{
_putchar('+');
return (1);
}
else if (n < 0)
{
_putchar ('-');
return (-1);
}
else
{
_putchar('0');
return (0);
}
}

0 comments on commit a18c009

Please sign in to comment.