#include<iostream.h> #include<conio.h> int main() { int a; cout<<"Enter any number:"; cin>>a; if(a>0) cout<<"The absolute value of number is:"<<a; else cout<<"The absolute value of number is:"<<-(a); getch(); return 0; }
Tags:
solution 2
#include<iostream.h> #include<conio.h> int main() { int a; cout<<"Enter any number:"; cin>>a; if(a>0) cout<<"The absolute value of number is:"<<a; else cout<<"The absolute value of number is:"<<-(a); getch(); return 0; }