

C Program to Find Absolute Value of a Given Number
source link: https://www.geeksforgeeks.org/videos/c-program-to-find-absolute-value-of-a-given-number/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

C Program to Find Absolute Value of a Given Number
- 10 Views
- 04/08/2022
In this video, we will write a C Program to Find Absolute Value of a Given Number.
What is absolute value?
The absolute value of any number is always positive. For any positive number, the absolute value is the number itself and for any negative number, the absolute value is (-1) multiplied by the negative number.
Examples:
Input: N = -23
Output: 23
Input: N = 45
Output: 45
There are two different approaches to find absolute value of a given numbers:
1. Using if-else condition: In this method, simply if-else conditions are used.
Here the Time Complexity is O(1) and Auxiliary Space is O(1).
2. Using ABS_Value: The inbuilt function ABS_Value() in stdlib.h library finds the absolute value of any number.
Here the Time Complexity is O(1) and Auxiliary Space is O(1).
Program to find absolute value of a given number:
https://www.geeksforgeeks.org/program-to-find-absolute-value-of-a-given-number/
Recommend
-
10
Number of subsets with a given OR valueNumber of subsets with a given OR value Given an array arr[] of length N, the ta...
-
6
Python Program to Determine Whether a Given Number is Even or OddPython Program to Determine Whether a Given Number is Even or OddWelcome to each of these. Today, we gonna learn
-
7
C++ Program to Find maximum value of Sum( i*arr[i]) with only rotations on given array allowedLast Updated : 28 Dec, 2021Given an array, only rotation operation is allowed...
-
11
C++ Program to Check if a Given Number is Ugly Number or notC++ Program to Check if a Given Number is Ugly Number or not990 Views29/07/2022
-
11
C Program to Determine Whether a Given Number is Even or OddSkip to content C Program...
-
7
-
6
C Program to Check if given number is Perfect SquareSkip to content
-
9
Python Program To Find Cube Root Of Given NumberSkip to content
-
8
Python Program To Find Square Root Of Given NumberSkip to content
-
7
C++ Program to Print the Largest possible Prime Number from a given numberSkip to content
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK