Arithmetic Instruction in c

C arithmetic instruction consists of a variable name on the left-hand side of = and variable names and 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 /.

For example:-

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 statement together are called ‘operands’. While executing an arithmetic statement the operands on the right-hand side are operated upon by the ‘arithmetic operators’ and the result is then assigned, using the assignment operator, to the variable on the left-hand side.

Types of Arithmetic statements:-

C arithmetic statement could be of three types. These are as follows:

(a) Integer mode arithmetic statement – In this statement, all operands are either integer variables or integer constants.

For example:-

int i, king, issac, noteit;

i=i+1; 	
king = issac * 234 + noteit - 7689;

(b) Real mode arithmetic statement – In this statement all operands are either real constants or real variables.

For example:-

float qbee, antink, si, prin, anoy, roi; 
qbee = antink + 23.123 / 4.5 * 0.3442; 
si = prin * anoy * roi / 100.0;

(c) Mixed mode arithmetic statement – In this statement some operands are integers and some operands are real.

For example:-

float si, prin, anoy, roi, avg; 
int a, b, c, num; 
si = prin * anoy * roi / 100.0 ; avg = ( a + b + c + num ) / 4;