Saturday 10 September 2022

Operator in C

C is a high level language and structured programming language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs.

 

C is very popular because of Reliability, Portability, Flexibility, Interactivity, and Modularity.

 

In C programming language operators are used to perform specific operations on variables and values during the flow of programs.

 


 

Following operators are available in C Language:

 

v  Arithmetic Operators

v  Assignment Operators

v  Comparison Operators

v  Logical Operators

v  Bitwise Operators

 

 

 

 

Operator

Description

+

It used to add two values.

-

It used to Subtracts two values.

*

It used to multiply two values.

/

It used to divide two values.

%

It used to find modulus.

++

It is used to Increases the value of a variable by 1.

--

It is used to decreases the value of a variable by 1.

 

Addition Operator

 

Example:-

 

#include <stdio.h>

void main()

{

int x = 5;

            int y = 10;

            printf("%d", x + y);

 }

Output

15

 

Subtraction Operator

 

Example:-

 

#include <stdio.h>

void main()

{

int x = 10;

            int y = 5;

            printf("%d", x - y);

 }

 

Output

5

 

 

Multiplication Operator

 

Example:-

 

#include <stdio.h>

void main()

{

int x = 10;

            int y = 5;

            printf("%d", x * y);

 }

 

Output

50

 

Division Operator

 

Example:-

#include <stdio.h>

void main()

{

int x = 10;

            int y = 5;

            printf("%d", x / y);

 }

 

Output

2

 

Modulus Operator

 

Example:-

#include <stdio.h>

void main()

{

            int x = 5;

            int y = 3;

            printf("%d", x % y);

}

 

Output

2

 

Increment Operator

 

 

Example:-

#include <stdio.h>

void main()

{

int x = 10;

            printf("%d", ++x);

}

 

Output

11

 

Decrement Operator

 

Example:-

#include <stdio.h>

void main()

{

int x = 10;

            printf("%d", --x);

}

 

Output

9

 

TCCI provides best teaching in different C programing languages through different learning method/media as per students convince.

 

For More Information:                                          

Call us @ 9825618292

Visit us @ http://tccicomputercoaching.com  

No comments:

Post a Comment