100% found this document useful (1 vote)
3K views

Operators in C

The document provides an overview of the C programming language and its main features. It discusses the different types of operators in C like arithmetic, relational, logical, assignment, ternary and increment/decrement operators. Examples are given to demonstrate how each operator works. Bitwise operators are also summarized. The document serves as an introduction to fundamental concepts in C programming.

Uploaded by

Shivam Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
3K views

Operators in C

The document provides an overview of the C programming language and its main features. It discusses the different types of operators in C like arithmetic, relational, logical, assignment, ternary and increment/decrement operators. Examples are given to demonstrate how each operator works. Bitwise operators are also summarized. The document serves as an introduction to fundamental concepts in C programming.

Uploaded by

Shivam Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 19

An industrial training report on

SOLIDWORKS

SUBMITTED TO:- --------------- SUBMITTED BY:- SHIVAM SHARMA


ITRP FACULTY ADVISOR ROLL NO:- (1719240193)
DEPARTMENT OF MECHANICAL DEPARTMENT OF MECHANICAL
ENGINEERING(GLBITM) ENGINEERING(GLBITM)
GREATER NOIDA GREATER NOIDA
• C is a procedural programming language. It was initially developed by Dennis Ritchie in the
year 1972. It was mainly developed as a system programming language to write an operating
system.
• The main features of C language include low-level access to memory, a simple set of
keywords, and clean style, these features make C language suitable for system
programming's like an operating system or compiler development.

• Many later languages have borrowed syntax/features directly or indirectly from C language.
Like syntax of Java, PHP, JavaScript, and many other languages are mainly based on C
language. C++ is nearly a superset of C language (There are few programs that may compile
in C, but not in C++).
TYPES OF OPERATORS
1) Arithmetic Operators
2) Relational ( Comparison) Operators
3) Logical Operators
4) Assignment Operators
5) Ternary (Conditional) Operator
6) Increment / Decrement Operators
7) Bitwise Operators
ARITHMETIC OPERATORS

1) + Addition
2) - Subtraction
3) * Multiply
4) / Divide
5) % Modulus ( Remainder of Division )
void main() EXAMPLE
{
int x;
x=10+20;
printf ( “%d \n” , x);
x=30-5;
printf ( “%d \n” , x);
x=6*8;
printf ( “%d \n” , x);
x=100/20;
printf ( “%d \n” , x);
x=25%7;
printf ( “%d \n” , x);
}
OUTPUT
RELATIONAL ( COMPARISON)
OPERATORS

1) > Greater Than


2) < Less Than
3) >= Greater Than or Equal To
4) <= Less Than or Equal To
5) == Equal To
6) != Not Equal To
LOGICAL OPERATORS

1) && And
2) || Or
3) ! Not
ASSIGNMENT OPERATORS

1) =
2) += x += 5 means x = x + 5
3) -= x -= 5 means x = x - 5
4) *= x *= y means x=x*y
5) /= x /= 5 means x = x / 5
6) %= a %= b means a = a % b
EXAMPLE
void main( )
{
int x=100;
x/=5;
printf ( “%d \n” , x);
x*=3;
printf ( “%d \n” , x);
x%=8;
printf ( “%d \n” , x);

}
OUTPUT
TERNARY (CONDITIONAL)
OPERATOR

? :

Syntax:
Condition ? Statement 1 : Statement 2 ;

True False
EXAMPLE

void main()
{
int x=10;
x > 50 ? printf(“Hello”) : printf(“Welcome”);
}
OUTPUT

Note : if we write “x < 50” in the above


program than output will be :

Hello
INCREMENT / DECREMENT
OPERATORS

++ Increment Operator
-- Decrement Operator

X++ means X=X+1


X-- means X=X-1
EXAMPLE

void main()
{
int x=100, y=200;
x++;
y--;
printf( “ %d \n %d” , x , y);
}
OUTPUT
BITWISE OPERATORS

1) & Bitwise And


2) | Bitwise Or
3) ^ Bitwise XOR
4) << Bitwise Left Shift
5) >> Bitwise Right Shift
6) ~ Bitwise Complement
Thank You

You might also like