# C Program To Find Absolute Value of a Number

In this tutorial, i am going to show you how to find absolute value of a number in the c program with help of abs() function and arithmetic operator.

## Find Absolute Value of a Number in C Programs

Here, i will show you two program to find absolute value of a number using function and arithmetic operator in c programs:

• C Program To Find Absolute Value of a Number Using abs() function
• C Program To Find Absolute Value of a Number using Arithmetic operator

### C Program To Find Absolute Value of a Number Using abs() function

```#include<stdio.h>
#include<stdlib.h>

int main()
{
int num;

printf("Enter a positive or negative number :- ");
scanf("%d", &num);

printf("Absolute Value of %d is %d\n", num, abs(num));

return 0;
} ```

### C Program To Find Absolute Value of a Number using Arithmetic operator

```#include<stdio.h>
#include<stdlib.h>

int main()
{
int num, aNum;

printf("Enter a positive or negative number :- ");
scanf("%d", &num);
if(num<0){
aNum = (-1)*num;
printf("Absolute Value of %d is %d\n", num, aNum);
}else{
printf("Absolute Value of %d is %d\n", num, num);
}

return 0;
} ```