Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change a positive number to negative and vice versa?

I'm thinking there must be a function to do both. I think fabs will do negative to positive.

But not sure about the other way around ?

like image 792
Jules Avatar asked Dec 28 '11 10:12

Jules


Video Answer


1 Answers

num *= -1 will change the sign from positive to negative and vice versa.

like image 180
Sergey Kalinichenko Avatar answered Oct 19 '22 16:10

Sergey Kalinichenko