功 能: 取绝对值
原 型: int abs(int x)
#include <stdio.h> /*printf*/
#include <math.h> /*abs*/
int main()
{int x, y;x = abs(50);printf("输出x的值 = %d\n", x);y = abs(-100);printf("输出y的值 = %d\n", y);return 0;
}
编译并运行程序,结果如下:
输出x的值 = 50
输出y的值 = 100
功 能: 取绝对值
原 型: int abs(int x)
#include <stdio.h> /*printf*/
#include <math.h> /*abs*/
int main()
{int x, y;x = abs(50);printf("输出x的值 = %d\n", x);y = abs(-100);printf("输出y的值 = %d\n", y);return 0;
}
编译并运行程序,结果如下:
输出x的值 = 50
输出y的值 = 100