Ask Question
7 November, 10:46

Write assignment statements that perform thefollowing operations with the variables a, b, and c.

a) Adds 2 to a and stores theresult in b.

b) Multiples b times 4 andstores the result in a.

c) Divides a by 3.14 and storesthe result in b.

d) Subtracts 8 from b andstores the result in a.

+1
Answers (1)
  1. 7 November, 13:09
    0
    An assignment statement's overall syntax is-

    variable = expression;

    Where the variable must be declared; the variable may be a simple name, or an indexed location in an array, or an object's field (instance variable) or a class static field; and the expression must result in a value that is compatible with the variable type. In other words, it must be feasible to cast the expression to the variable type.

    Examples: int i = 4;

    a) b = (a+2);

    (a+2) is the expression for adding 2 to a, whereas b equal to the result of (a+2).

    b) a=b*4;

    (b*4) is the expression for multiples b times 4, whereas a equal to the result of (b*4)

    c) b = (a/3.14)

    (a/3.14) is the expression for divides a by 3.14, whereas b equal to the result of (a/3.14)

    d) a = (b-8)

    (b-8) is the expression for Subtracts 8 from b, whereas a equal to the result of (b-8)
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write assignment statements that perform thefollowing operations with the variables a, b, and c. a) Adds 2 to a and stores theresult in b. ...” 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