怎么求一个浮点数的绝对值呢。求教!下面是求整数的绝对值!
#include <stdio.h>#include <stdlib.h>
#include <math.h>
main()
{
int m,n;
printf("请输入一个数m:");
scanf("%d",&m);
n=abs(m);
printf("%d的绝对值是:%d\n",m,n);
system("pause");
return 0;
}
2012-10-30 11:27
2012-10-30 11:29

2012-10-30 12:39
2012-10-30 12:41
2012-11-01 16:17
2012-11-01 23:27
2012-11-02 09:07
2012-11-02 12:31
程序代码:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void)
{
double m,n;
printf("请输入一个数m:");
scanf("%lf",&m);
n=fabs(m);
printf("%f的绝对值是:%f\n",m,n);
system("pause");
return 0;
}
2012-11-02 12:57
2012-11-02 13:01