+ 1

How to print an positve integer even if the value is negative? (on C)

I have a variable (integer) and I want to print it, but I need to print a positive number even if the variable returns a negative number, how can I do it?

9th Feb 2019, 1:03 AM
Chaves Dias Jr.
Chaves Dias Jr. - avatar
3 Answers
+ 2
With stdlib.h header you can use "int abs(int x); " function .
9th Feb 2019, 1:15 AM
Elghozi Nasreddine
Elghozi Nasreddine - avatar
+ 2
Thanks for the answers.
9th Feb 2019, 6:04 PM
Chaves Dias Jr.
Chaves Dias Jr. - avatar