how to make negative numbers into positive

前端 未结 8 1766
天命终不由人
天命终不由人 2021-02-01 14:09

I am having the negative floating point number as:

a = -0.340515;

to convert this into positive number I used the abs() method as:



        
8条回答
  •  失恋的感觉
    2021-02-01 14:28

    a *= (-1);
    

    problem solved. If there is a smaller solution for a problem, then why you guys going for a complex solution. Please direct people to use the base logic also because then only the people can train their programming logic.

提交回复
热议问题