Ask Question
12 April, 15:41

Three ways to increase value of a variable

+5
Answers (1)
  1. 12 April, 16:45
    0
    Three ways to increase the value of variable are given below. To eleborate the answer, I am taking a variable x that need to be increase.

    x=x+1 x+ + x+=1

    Explanation:

    There are three ways to increase the value of variable.

    1. x = x+1

    In this case, each time value of x (variable) is incremented and stored in that variable. This equation increase the value of x by 1 each time. For Example

    if x=1

    then in first iteration

    x = x+1 = 2;

    If we want to increase the value of x by more than 1, we can add that value with x, as x+2, x+3 and so on.

    2. x++

    This will increment the value of x by 1. If we use this equation multiple time in program, each time it will increase 1 in value of x.

    3. x+=1

    This also works same as equation 1. It will increment 1 in this form and can be changed with 2, 3 and so on.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Three ways to increase value of a variable ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers