Ask 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.

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 January, 17:59
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers