Computer Science, asked by XxhotorcutiexX, 11 months ago

What is the difference between the following statements :-
a=10 and a==10?

Answers

Answered by ArchitPathak
72

Answer:

a=10 is used to assignment, means the value of a will be 10. a==10 is a binary operator, and used to do comparison .

Answered by AskewTronics
25

'a=10' is used to assign the value of 10 in 'a' variable whereas 'a==10' compare the value of 'a' variable with 10.

Explanation:

  • In "a=10", a is a variable that is initialized by 10 value because in any programming language "=" stands for assignment operator which is used to assign the value for any variable.
  • In "a==10", a is a variable whose value is get compared by 10 value because in any programming language, "==" is known as comparison operator which is used to compare the value and gives 0 if value not matched but it gives 1 if value matched.

So when a user writes "a==10" in the print statement and "a=10" is declared above, then the print statement gives 1 because firstly there is assigned 10 value for a variable and then it is compared with 10 which is matched.

Learn More:

  • Difference between assignment operator equality operator:https://brainly.in/question/12411613
  • Types of assignment operator.https://brainly.in/question/5793057
Similar questions