Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

OPERATOR

Rating
-
Sold
-
Pages
7
Uploaded on
31-12-2024
Written in
2024/2025

C LANGUAGE NOTES ON ANSHUMAN SHARMA BOOK LEARN PROGRAMMING IN C

Institution
Course

Content preview

Operators
An operator is a symbol that tells the compiler to perform specific mathematical or
logical functions. C language is rich in built-in operators and provides the following
types of operators −

• Arithmetic Operators
• Relational Operators
• Logical Operators
• Bitwise Operators
• Assignment Operators
• Misc Operators
We will, in this chapter, look into the way each operator works.

Arithmetic Operators
The following table shows all the arithmetic operators supported by the C language.
Assume variable A holds 10 and variable B holds 20 then −
Show Examples


Operator Description Example


+ Adds two operands. A + B = 30


− Subtracts second operand from the first. A − B = -10


* Multiplies both operands. A * B = 200


/ Divides numerator by de-numerator. B/A=2


% Modulus Operator and remainder of after an integer division. B%A=0


++ Increment operator increases the integer value by one. A++ = 11


-- Decrement operator decreases the integer value by one. A-- = 9

, Example 1: Arithmetic Operators
// Working of arithmetic operators
#include <stdio.h>
int main()
{
int a = 9,b = 4, c;

c = a+b;
printf("a+b = %d \n",c);
c = a-b;
printf("a-b = %d \n",c);
c = a*b;
printf("a*b = %d \n",c);
c = a/b;
printf("a/b = %d \n",c);
c = a%b;
printf("Remainder when a divided by b = %d \n",c);

return 0;
}



c = 5
c = 10
c = 5
c = 25
c = 5
c = 0




Relational Operators
The following table shows all the relational operators supported by C. Assume
variable A holds 10 and variable B holds 20 then −
Show Examples


Operator Description Example

Written for

Institution
Course

Document information

Uploaded on
December 31, 2024
Number of pages
7
Written in
2024/2025
Type
Class notes
Professor(s)
Kanika jindal
Contains
Commerce 1st semester

Subjects

$26.89
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
Himanshugupta01

Get to know the seller

Seller avatar
Himanshugupta01 GUJRANWALA GURU NANAK INSTITUTE OF MANAGEMENT AND TECHNOLOGY
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
10
Last sold
-
PTU EDUCATOR

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions