Skip to main content

C++ Program Finding The Absolute Value

#include<iostream>
using namespace std;
int main()
{
cout<<" enter any number";
cin>>num;
if(num>0)
{
cout<<"The absolute value of number is:"<< num;
}
else
{
cout<<"The absolute value of number is :"<< -(num);
}
return 0;
}


OUTPUT

Enter Any number: 2
The absolute value of number is 2

Comments

Popular posts from this blog

Difference between px,dip,dp and sp in Android

Difference between px,dip,dp and sp in Android MEANING px   -> It stands for pixel and has a same meaning to the resolution of the screen density. it corresponds to the actual pixel in the screen. dip ->Dip and dip both are one and the same thing.It stands for density independent pixel.It is dependent on physical intensity pixel of screen. sp  It stands for scaled pixel. USAGE px It is used with the images to resize the image.used to fit the image to screen and change the size of the image.