♦ fabs() - math.h
♣ Example1: fabs()
Input:
xxxxxxxxxx
1
#include <stdio.h>
2
#include <math.h>
3
4
5
int main()
6
{
7
8
9
double num1=-2.5;
10
double result1= fabs(num1);
11
printf("%f\n", result1);
12
13
14
15
double num2=0;
16
double result2= fabs(num2);
17
printf("%f\n", result2);
18
19
20
21
double num3=4;
22
double result3= fabs(num3);
23
printf("%f\n", result3);
24
25
26
27
return 0;
28
}
Output: