C Exercises: Return the absolute value of a long integer
8. Absolute Value of a Long Integer
Write a C program to return the absolute value of a long integer.
Sample Solution:
C Code:
Sample Output:
Input 1st number (positive or negative) : 25 Input 2nd number (positive or negative) : -125 The absolute value of 1st number is : 25 The absolute value of 2nd number is : 125
Flowchart:

For more Practice: Solve these Related Problems:
- Write a C program to compute the absolute value of a long integer without using the abs() function.
- Write a C program to return the absolute value of a long integer and properly handle edge cases for minimum values.
- Write a C program to implement the absolute value function for long integers using bit manipulation.
- Write a C program to determine the absolute value of a long integer using conditional operators only.
C Programming Code Editor:
Previous: Write a C program to integral quotient and remainder of a division.
Next: Write a C program to get the environment string.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.