Program to print the absolute value of a number in C

#include <stdio. h>
int main( )
{ 
int x;
printf( “Enter the number: \n”) ;
scanf( “%d”,&x) ;
if( x<0)
	x=-x;
printf( “\nThe absolute value of the number is %d. \n”, x) ;
return 0;
}

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.