**Arithmetic Operators In C**

Here are C’s five basic arithmetic operators:

- The +operator adds its operands. For example, 4 + 20 evaluates to 24.
- The -operator subtracts the second operand from the first. For example, 12 – 3 evaluates to 9.
- The *operator multiplies its operands. For example, 28 * 4 evaluates to 112.
- The /operator divides its first operand by the second. For example, 1000 / 5 evaluates to 200. If both operands are integers, the result is the integer portion of the quotient. For example, 17 / 3 is 5, with the fractional part discarded.
- The %operator finds the modulus of its first operand with respect to the second. That is, it produces the remainder of dividing the first by the second. For example, 19 % 6 is 1 because 6 goes into 19 three times, with a remainder of 1. Both operands must be integer types; using the % operator with floating-point values causes a compile-time error. If one of the operands is negative, the sign of the result depends on the implementation.

Of course, you can use variables as well as constants for operands. Listing 3.10 does just that. Because the % operator works only with integers, we’ll leave it for a later example.

**This table shows us the major function and use of arithmetic operators**

Let’s take an example that shows us the perfect use of arithmetic operators and make us more clear.

```
#include<stdio.h>
#include<conio.h>
void main()
{
// we will add these two numbers
int n = 25;
int m = 13;
printf("Total of n + m = ", (n + m));
}
```

Output on Screen:

Total of n + m = 38;

**Increment and decrement operators**

Increment operators are used for increasing the value of the variable by one and decrement operators are used to decrease the value of the variable by one.

Both increment and decrement operator are used on single operand or variable, so it is called as unary operator. Unary operators are having a higher priority than the other operators it means unary operators are execute before other operators.

Example program;

```
#include<stdio.h>
#include<conio.h>
void main()
{
int x,i;
i=10;
x=++i;
printf("x: %d",x);
printf("i: %d",i);
getch();
}
```

**Output on Screen:**

**X: 11**

**I: 11**

### Comments in C

Comments are notes of explanation that document lines or sections of a program.

**Single-Line Comments** – This can be done by using “//” this symbol at the start of the line.

Example:

// This is a single-line comment

**Multiple Line Comments** – This can be done by using “/*” this symbol at the starting point and ends with “*/” this symbol at the endpoint.

```
Example:
/*
This is multiple
Line
Comment
Example
*/
```

### Programming Style in C

Programming style refers to the way a programmer uses identifiers, spaces, tabs, blank lines, and punctuation characters to visually arrange a program’s source code.

Best programming styles to use in a program to make more readable and good looking with professional approach.

- Readability
- Maintainability
- Comments
- Naming

**Decision Making Programming in c**

**Relational Operators**

Relational operators allow you to compare numerically and char values and determine whether one is greater than, Jess than, equal to, or not equal to another.

**The table below shows the exact detail of relational operators**

So, we already understand from the table above now it’s time to understand through the example of this understanding, here below is the example with the solution.

**Logical Operators**

Logical operators connect two or more relational expressions into one or reverse the logic of an expression.

In the above table, I created is just to show you what is the purpose of these operators in c program with if/else/if/else if statement

Note: This program shows us about OR operator and AND operator with if statement.