What's the error in this program? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's the error in this program?

It is supposed to take a number from the user and either multiply by 4 or divide by 777 depending on the number entered by the user. Thanks! #include <iostream> using namespace std; int main() { cout << "Welcome " << "To " << "Numbers!" << endl; int x=cin if(x<666){x*4} if()else(x>666){x/777} return 0; }

2nd Aug 2017, 3:04 AM
Mason Roy
Mason Roy - avatar
2 Answers
+ 11
#include <iostream> using namespace std; int main() { int x; cout << "Welcome " << "To " << "Numbers!" << endl; cin>>x; if(x<666){ x=x*4; cout<<x; } else if(x>666){ x=x/777; cout<<x; } return 0; }
2nd Aug 2017, 3:46 AM
P R
P R - avatar
+ 1
P R Thank You!
2nd Aug 2017, 3:48 AM
Mason Roy
Mason Roy - avatar