Answer to Question #128951 in C++ for Lili

Question #128951

Found and fix errors in the following code:

if(number%2=0)
cout<<"Even.";
else
cout<<"Odd.";
1
Expert's answer
2020-08-11T12:50:24-0400
if(number%2=0)
cout<<"Even.";
else
cout<<"Odd.";

The first string contains an error: the assignment operator is used (=). But we have to use the equality operator (==).


Fixed code is:

if(number%2==0)
cout<<"Even.";
else
cout<<"Odd.";

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS