Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

While solving the equation, why does it show an error for one variable 'a'?

We have to solve a simple equation using C where the values of the variables are already given as

a = 2, b = 3, c = 4

the equation is:

a + b *= c - +5

I am getting an error message as "lvalue required as left operand of assignment"

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I had tried to put the equation equal to some new variable such as x and then I was trying to find the answer. Even if I am removing a variable from the equation it does not show any error and gives the output.

enter image description here

>Solution :

I don’t know what you are trying to do, but *= doesn’t appear to do what you think it does.

*= is an assignment operator. It evaluates its left-hand side and its right-hand side, multiplies them together, and assigns the result to the result of its left-hand side.

The result of a + b is not something to which you can assign. This is not valid code.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading