Subscribe Us

C program to find absolute value of a given number- c exercise - smartduniya

Absolute value in c program

To verify the absolute value in C programming . It is easy to do. let's read

We all know about absolute value . Absolute value of a number is with out any sign.
Example , If we asked to find the absolute value of ( - 58 ) ?
What we do to find absolute value of -58 . We take mod , mod of (-58)..
I - 58 I = 58
We get, (-58) absolute value is 58 .

As the same process we use in c programming .
In this post we will learn , how to find absolute value of any number by c programming.
From above we get some basic knowledge about absolute value, and how to find it.

Suppose a problem is

Any number input through the keyboard . write a program to find out the absolute value of this number.

To solve this problem ,
we take a function , it is abs() function.
It is the easy way to find out absolute value.
To understand better go to the code . How to find absolute vale using abs() function
Let's Go to the code :

Absolute value in c

Note :Click on the button to copy the text from the text field. Try to paste the text (e.g. ctrl+v) afterwards in a different window, to see the effect.

write the above code or copy this code . save this with '.c ' extension.In this screen User have to input a number to get it's absolute value.

Out put :

Absolute value in c

Post a Comment