All rights are reserved by Niteesh Kumar.. Theme images by Storman. Powered by Blogger.

Followers

Total Pageviews

Blog Archive

Follow by Email

Translate

Wednesday, 17 September 2014

C++ program to find the absolute value of a number.


Absolute value means only how far a number is from zero.
or we can say, absolute value of a=|a|
c++ code



#include <iostream.h> #include <math.h> void main() { int a; cout<<"Enter number : "; cin>>a; cout<<"\nAbsolute value = "<<sqrt(a*a); 
//OR use - cout<<"\n"<<fabs(a); }


OUTPUT-
Enter number :-3
Absolute value =3

0 on: "C++ program to find the absolute value of a number."