绝对值c语言怎样表示
在C语言中,可使用abs()
函数来表示一个数的绝对值。该函数的原型以下:
int abs(int x);
使用方法以下:
#include <stdio.h>
#include <stdlib.h>
int main() {
int x = ⑴0;
int absValue = abs(x);
printf("The absolute value of %d is %d", x, absValue);
return 0;
}
输出结果为:
The absolute value of ⑴0 is 10
TOP