pTutorial

New way to learn C programming

C abs function

Math.h: abs is a c math library function which is used to calculate the absolute value of the given number. Number can be integer, double, float etc.

For example entered number is -60 then result would be 60.

C abs function example



#include <stdio.h>

#include <conio.h>

#include <math.h>

void main()
{
int num, num1;

printf("Enter number to calculate Absolute value\n");

scanf("%d", &num);

num1 = abs(num); //store the Absolute value

printf("Absolute value of %d = %d\n", num, num1);

getch();
}


Download abs function example

Output of program

c PROGRAM FOR ABS FUNCTION

See Also

Php send mail   |   Angularjs controller   |   C program to swapping of two number

QUOTES OF THE DAY

Goal is tired by fire, brave men by adversity.

LIKE ON FACEBOOK

+1 ON GOOGLE

SHARE ON TWITTER