Can some fix this. ( code in description) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can some fix this. ( code in description)

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

14th Oct 2016, 1:14 AM
yared yohannes
yared yohannes - avatar
2 Answers
+ 1
you probably have used some special characters inside the code (like tab), because if you delete all spaces the code works...
14th Oct 2016, 7:16 AM
marcram
0
u better define new num = num * -1 but first lemme see the error
14th Oct 2016, 4:52 AM
Thai-Sang Trinh Tran
Thai-Sang Trinh Tran - avatar