Skip to content

Commit 12cb1e0

Browse files
committed
jvad
1 parent 23f1169 commit 12cb1e0

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed
Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
#include "main.h"
22

33
/**
4-
* print_number - prints an integer;
5-
* @n: integer to be printed;
6-
*/
4+
* print_number - Prints any integer with putchar
5+
* @n: Number to prints
6+
*
7+
* Return: Nothing
8+
*/
79
void print_number(int n)
810
{
9-
unsigned int n1;
11+
unsigned int x;
1012

1113
if (n < 0)
1214
{
13-
n1 = -n;
1415
_putchar('-');
15-
} else
16-
{
17-
n1 = n;
16+
n *= -1;
1817
}
1918

20-
if (n1 / 10)
21-
print_number(n1 / 10);
19+
x = n;
20+
21+
if (x / 10)
22+
print_number(x / 10);
2223

23-
_putchar((n1 % 10) + '0');
24+
_putchar(x % 10 + '0');
2425
}

0 commit comments

Comments
 (0)