Advertisement
Tahamina_Taha

The absolute value of an integer number

Aug 17th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.55 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3. #include<conio.h>
  4. //absolute value using abs function
  5. int main()
  6. {
  7.     /*The absolute value of an integer is the numerical
  8.     value without regard to whether the sign is negative or positive.
  9.     "without requesting user input "
  10.     int result=abs(enter any value);
  11.     printf("%d",result); */
  12.  
  13.     int absolute_value;
  14.     printf("Enter absolute value: \n");
  15.     scanf("%d",&absolute_value);
  16.     absolute_value=abs(absolute_value);
  17.     printf("absolute value is : %d",absolute_value);
  18.     return 0;
  19.  
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement