Arithmetic Instruction

    1100404 VIEW 1 0

Arithmetic instruction consists of a variable name on the left hand side of = and variable names & constants on the right hand side of =. The variables and constants appearing on the right hand side of = are connected by arithmetic operators like +, -, *, and /.

int ad; 
float kot, deta, alpha, beta, gamma;
ad = 3200;
kot = 0.0056;
deta = alpha * beta / gamma + 3.2 * 2 / 5;

Here, *, /, -, + are the arithmetic operators.

= is the assignment operator. 2, 5 and 3200 are integer constants.

3.2 and 0.0056 are real constants.

ad is an integer variable.

kot, deta, alpha, beta, gamma are real variables.

The variables and constants together in statements are called ‘operands’ that are operated upon by the ‘arithmetic operators’ and the result is assigned, using the assignment operator, to the variable on lefthand side.

Arithmetic operations can be performed on ints, floats and chars.

Thus the statements,

char x, y;
int z ;
x = 'a'
y = 'b'
z = x + y;