Ask Question
23 May, 01:01

Three ways to increase value of a variable

+4
Answers (1)
  1. 23 May, 04:44
    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?
Get an answer to your question ✅ “Three ways to increase value of a variable ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers