-
Notifications
You must be signed in to change notification settings - Fork 0
/
specifiers_3.c
45 lines (35 loc) · 864 Bytes
/
specifiers_3.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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "main.h"
/**
* print_oct - prints a number in octal (base 8)
* @args: argument pointer
* Return: number of characters printed
*/
int print_oct(va_list args)
{
unsigned int num = va_arg(args, unsigned int);
return (print_octal(num));
}
/**
* print_hex - prints a number in hexadecimal (base 16) in lower case
* @args: argument pointer
* Return: number of characters printed
*/
int print_hex(va_list args)
{
unsigned int num = va_arg(args, unsigned int);
if (!num)
return (_putchar('0'));
return (print_hexadecimal(num, 0, 0));
}
/**
* print_HEX - prints a number in hexadecimal (base 16) in upper case
* @args: argument pointer
* Return: number of characters printed
*/
int print_HEX(va_list args)
{
unsigned int num = va_arg(args, unsigned int);
if (!num)
return (_putchar('0'));
return (print_hexadecimal(num, 0, 1));
}