C Program to Find Absolute Value of Number

Write C Program to Find Absolute Value of Given Number

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

int main()
{
	int n , absolute;
	
	printf("Enter the value :--> ");
	scanf("%d", &n);
	 
	absolute = abs(n);       //abs function in stdlib header file
	
	printf("The absolute value of the number is :--> %d", absolute);
	
	return 0;
	
}

Output:

Enter the value :–> 98


The absolute value of the number is :–> 98


<< Previous | Next >>