# arithmetic operators in C

arithmetic operators C-:”C” provide all the basic arithmetic operators the operator + – multiplication division these are work for the same way as they do in other language these can operate on any built in data type allowed in C .the unary   minus operator in effect multiplies its single operate by -1 therefore a number preceded by a minus sign change its sign.

(-) Substraction or unary minus

(*) multiplication

(/) division

(%) modulo division

arithmetic operators are three types these are :

1 integer arithmetic operators-: when both the opponents in a single automatic expression such as a + b are integer the expression is called an integer expression and the operation is called integer arithmetic. the largest integer value depends on the machine as pointed out earlier.

here are some examples

a- b=10

a + b =18

during integer division if both the options are of the same sign the result is a truncated towards zero if one of them is negative the direction of truncation is implementation depend that is

6 / 7=0 and -6/-7=0

during modulo division the sign of the result is always the sign of the first operand that is

-14 %3 = -2 and -14 %-3 =-2

simple example  of c programe

———————————————–

#include<stdio.h>———Library of c language

main()

{

int months,days;

printf(“Enter of days \n”);

Scanf(“%d”,&days)

months=days=30;

days=days%30;

printf(“months=%d days=%d”, months,days);

}

OUTPUT

Enter days 310

months=10  days=10

Real arithmetic-: arithmetic  operation involving only real operands is called real arithmetic. A real operands many assumes  values either  in decimal or as potential notation scenes floating point values are rounded to the number of significant digits permissible the final value is an approximation of the correct results if X Y and Z float

x=6.0/7.0=0.857

y=1/2=0.5

z=2/5=0.4

Mixed-mod  arithmetic operator -: when one of the operands is real and the another is an integer the expression is called a mixed mode arithmetic expression if either operands is one of the real type then only the real operation is performed and the result is always a real number these are

15/10=1.5