Program to Find the absolute value of an integer taken as input.

#include <stdio.h>

int main(void)
{
int num;

printf("\nEnter a number : ");
scanf("%d" ,&num);

if(num < 0)
{
printf("\nAbsolute value of %d is %d" ,num ,-num);
}
else
{
printf("\nAbsolute value of %d is %d" ,num ,num);
}


return 0;
}

No comments:

Post a Comment

kiss on google ads if you are anonymous because your ip is trackable.thank you.

......from.admin