#include <math.h>
int abs( int num );
返回参数 num 的绝对值。
#include <stdio.h>
#include <math.h>
int main(void)
{
int number = -1234;
printf("number: %d absolute value: %d\n", number, abs(number));
return 0;
}输出结果:
number: -1234 absolute value: 1234