SlideShare a Scribd company logo
1 of 20
Operators in c programming
Name : Krishna kumar Pankaj
Roll No : 13/IT/22
What is Operators ?
๏ต An operator is a symbol that is used to perform certain mathematical or
logical operations.
๏ต Operator is used to manipulate data and variables.
Types of operators
๏ต In C programming Operators classified in to various categories
๏ต 1. Arithmetic operators
๏ต 2. Relational operators
๏ต 3. Logical operators
๏ต 4. Assignment operators
๏ต 5. Increment & Decrement operators
๏ต 6. Conditional operators
๏ต 7. Bitwise operators
๏ต 8. Special operators
Arithmetic operators
๏ต Arithmetic operators used to perform Arithmetic operations.
๏ต There are following Arithmetic operators in c language
Example :
๏ต #include<stdio.h>
#include<conio.h>
int main()
{
int x=25;
int y=5;
printf("%d+%d=%dn",x,y,x+y);
printf("%d-%d=%dn",x,y,x-y);
printf("%d*%d=%dn",x,y,x*y);
printf("%d/%d=%dn",x,y,x/y);
getch();
}
๏ต Output :
25+5=30
25-5=20
25*5=125
25/5=5
Relational operators
๏ต Relational operators compare between two operands and return in terms of
true or false
๏ต There are following Relational operators.
Example :
#include<conio.h>
#include<stdio.h>
int main()
{
int a, b;
printf("Enter values for a and b : ");
scanf("%d%d",&a,&b);
printf("n The < value of a is %d", a<b);
printf("n The <= value of a is %d", a<=b);
printf("n The > value of a is %d", a>b);
printf("n The >= value of a is %d", a>=b);
printf("n The == value of a is %d", a==b);
printf("n The != value of a is %d", a!=b);
getch();
๏ต }
Logical operator
๏ต A Logical operator is used to compare or evaluate logical or relational
operations.
๏ต There are following logical operators
Example :
#include<stdio.h>
#include<conio.h>
int main()
{
int a, b;
printf("Enter values for a and b : ");
scanf("%d%d", &a, &b);
printf("n %d",(a<b)&&(a!=b));
printf("n %d",(a<b)||(b<a));
printf("n %d",!(a==b));
getch();
}
Assignment operator
๏ต An Assignment operator is used to assign a constant or a value of one
variable to another.
๏ต = is an Assignment operator.
๏ต you can use the assignment for multiple assignment as follows:
๏ต x=y=z=20;
Increment Operator(++)
๏ƒ˜ Increment operator are increase the value of subsequent
๏ƒ˜ Increment operator are two types as follows:
โ€ข post Increment
โ€ข Ex : x=5;x++;x=5
โ€ข pre Increment
โ€ข x=5;++x;x=6
Decrement operator(--)
๏ต Decrement operator Decrease the value to one ,two and so on.
๏ต Decrement operator are also two type as
โ€ข Post Decrement
โ€ข x=5;x--;x=5
โ€ข pre decrement
โ€ข x=5;--x;x=4
Example of Increment & Decrement
operator
#include<stdio.h>
#include<conio.h>
int main()
{
int a,b,c;
printf("Enter the values for a and b :");
scanf("%d%d", &a, &b);
printf("n The value of c is %d", c=++a);
printf("n The value of c is %d", c=a++);
printf("n The value of c is %d", c=--b);
printf("n The value of c is %d", c=b--);
}
๏ต Output
Enter the value of a and b : 3 ,7
The value of c is 4
The value of c is 4
The value of c is 6
The value of c is 6
Conditional operator
๏ƒ˜ They are also called as ternary operator.
๏ƒ˜ They are also called as ?: operator.
๏ƒ˜ Ternary operator Takes on 3 Argument
Where
1) Expression 1 is condition
2) Expression2 is Statement Followed if Condition is True
3) Expression2 is Statement Followed if Condition is False
True
Condition ? Block 1 : Block 2
False
Example :
#include<stdio.h>
void main()
{
int a, b, x;
printf("Enter the values of a add b : ");
scanf("%d %d", &a, &b);
x=(a>b)?a:b;
printf("Biggest Value is :%d",x);
}
Bitwise Operator
๏ต One of the C powerful Features is a set of bit manipulation operators
๏ต There are various Bitwise Operators in C as following Table.
1. & (bitwise AND) Takes two numbers as operand and does AND on every bit of
two numbers. The result of AND is 1 only if both bits are 1.
2. | (bitwise OR) Takes two numbers as operand and does OR on every bit of two
numbers. The result of OR is 1 any of the two bits is 1.
3. ^ (bitwise XOR) Takes two numbers as operand and does XOR on every bit of
two numbers. The result of XOR is 1 if the two bits are different.
4. << (left shift) Takes two numbers, left shifts the bits of first operand, the
second operand decides the number of places to shift.
5. >> (right shift) Takes two numbers, right shifts the bits of first operand, the
second operand decides the number of places to shift.
6. ~ (bitwise NOT) Takes one number and inverts all bits of it
Special Operator
๏ต There are many special operators use in c programming.
๏ต Comma operator
๏ต Sizeof Operator
Comma Operator
๏ต Evaluate of comma operator โ€“ Left to Right
๏ต Uses of comma operator as following :
๏ต Multiples Declaration
๏ต Multiples Initialization
๏ต Multiples Variation
๏ต Multiples Statement
๏ต Example of comma operator
๏ต X=12,y=10,z=18
๏ต For( i=0,j=0;i<5,j<5;i++,j++ )
Sizeof operator
๏ต Sizeof operator calculate the size of data
๏ต i.e: How many bit a specific data having.
๏ต Syntax of sizeof operator:
๏ต Sizeof(variable);
Example :
sizeof(a), where a is interger, will return 4
Thank you
Any Queries ???
Go to Google Or
Email me at โ€œKrishna.pankaj@hotmail.comโ€

More Related Content

What's hot

Function overloading(c++)
Function overloading(c++)Function overloading(c++)
Function overloading(c++)Ritika Sharma
ย 
2. operators in c
2. operators in c2. operators in c
2. operators in camar kakde
ย 
Control statements in c
Control statements in cControl statements in c
Control statements in cSathish Narayanan
ย 
Function Pointer
Function PointerFunction Pointer
Function PointerDr-Dipali Meher
ย 
Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++Neeru Mittal
ย 
Expression and Operartor In C Programming
Expression and Operartor In C Programming Expression and Operartor In C Programming
Expression and Operartor In C Programming Kamal Acharya
ย 
Operators and expressions
Operators and expressionsOperators and expressions
Operators and expressionsvishaljot_kaur
ย 
Constructor and Types of Constructors
Constructor and Types of ConstructorsConstructor and Types of Constructors
Constructor and Types of ConstructorsDhrumil Panchal
ย 
Operators in Python
Operators in PythonOperators in Python
Operators in PythonAnusuya123
ย 
Preprocessor directives in c language
Preprocessor directives in c languagePreprocessor directives in c language
Preprocessor directives in c languagetanmaymodi4
ย 
Pointers in c++
Pointers in c++Pointers in c++
Pointers in c++Vineeta Garg
ย 
User defined functions in C
User defined functions in CUser defined functions in C
User defined functions in CHarendra Singh
ย 
Operator & Expression in c++
Operator & Expression in c++Operator & Expression in c++
Operator & Expression in c++bajiajugal
ย 
Structure in C
Structure in CStructure in C
Structure in CKamal Acharya
ย 
Operator Overloading
Operator OverloadingOperator Overloading
Operator OverloadingNilesh Dalvi
ย 
Operators and Expressions
Operators and ExpressionsOperators and Expressions
Operators and ExpressionsMunazza-Mah-Jabeen
ย 
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programmingprogramming9
ย 

What's hot (20)

Function overloading(c++)
Function overloading(c++)Function overloading(c++)
Function overloading(c++)
ย 
2. operators in c
2. operators in c2. operators in c
2. operators in c
ย 
Control statements in c
Control statements in cControl statements in c
Control statements in c
ย 
Function Pointer
Function PointerFunction Pointer
Function Pointer
ย 
Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++
ย 
Expression and Operartor In C Programming
Expression and Operartor In C Programming Expression and Operartor In C Programming
Expression and Operartor In C Programming
ย 
Operators and expressions
Operators and expressionsOperators and expressions
Operators and expressions
ย 
Constructor and Types of Constructors
Constructor and Types of ConstructorsConstructor and Types of Constructors
Constructor and Types of Constructors
ย 
Operators in Python
Operators in PythonOperators in Python
Operators in Python
ย 
Preprocessor directives in c language
Preprocessor directives in c languagePreprocessor directives in c language
Preprocessor directives in c language
ย 
Pointers in c++
Pointers in c++Pointers in c++
Pointers in c++
ย 
User defined functions in C
User defined functions in CUser defined functions in C
User defined functions in C
ย 
Pointer in c
Pointer in cPointer in c
Pointer in c
ย 
Operator & Expression in c++
Operator & Expression in c++Operator & Expression in c++
Operator & Expression in c++
ย 
Structure in C
Structure in CStructure in C
Structure in C
ย 
Operator Overloading
Operator OverloadingOperator Overloading
Operator Overloading
ย 
Operators and Expressions
Operators and ExpressionsOperators and Expressions
Operators and Expressions
ย 
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programming
ย 
Functions in C
Functions in CFunctions in C
Functions in C
ย 
C functions
C functionsC functions
C functions
ย 

Similar to Operators

Operators1.pptx
Operators1.pptxOperators1.pptx
Operators1.pptxHARSHSHARMA840
ย 
B.sc CSIT 2nd semester C++ Unit2
B.sc CSIT  2nd semester C++ Unit2B.sc CSIT  2nd semester C++ Unit2
B.sc CSIT 2nd semester C++ Unit2Tekendra Nath Yogi
ย 
2 EPT 162 Lecture 2
2 EPT 162 Lecture 22 EPT 162 Lecture 2
2 EPT 162 Lecture 2Don Dooley
ย 
introduction to c programming and C History.pptx
introduction to c programming and C History.pptxintroduction to c programming and C History.pptx
introduction to c programming and C History.pptxManojKhadilkar1
ย 
ppt on logical/arthimatical/conditional operators
ppt on logical/arthimatical/conditional operatorsppt on logical/arthimatical/conditional operators
ppt on logical/arthimatical/conditional operatorsAmrinder Sidhu
ย 
additional.pptx
additional.pptxadditional.pptx
additional.pptxYuvraj994432
ย 
Interesting facts on c
Interesting facts on cInteresting facts on c
Interesting facts on cDurgadevi palani
ย 
C program
C programC program
C programAJAL A J
ย 
C Operators and Control Structures.pdf
C Operators and Control Structures.pdfC Operators and Control Structures.pdf
C Operators and Control Structures.pdfMaryJacob24
ย 
Programming presentation
Programming presentationProgramming presentation
Programming presentationFiaz Khokhar
ย 
C++.pptx
C++.pptxC++.pptx
C++.pptxSabi995708
ย 
Unit i intro-operators
Unit   i intro-operatorsUnit   i intro-operators
Unit i intro-operatorsHINAPARVEENAlXC
ย 
C-PPT.pdf
C-PPT.pdfC-PPT.pdf
C-PPT.pdfchaithracs3
ย 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAAiman Hud
ย 
data type.pptxddddswwyertr hai na ki extend kr de la
data type.pptxddddswwyertr hai na ki extend kr de ladata type.pptxddddswwyertr hai na ki extend kr de la
data type.pptxddddswwyertr hai na ki extend kr de laLEOFAKE
ย 
Operators-computer programming and utilzation
Operators-computer programming and utilzationOperators-computer programming and utilzation
Operators-computer programming and utilzationKaushal Patel
ย 
C Operators and Control Structures.pptx
C Operators and Control Structures.pptxC Operators and Control Structures.pptx
C Operators and Control Structures.pptxramanathan2006
ย 

Similar to Operators (20)

Operators1.pptx
Operators1.pptxOperators1.pptx
Operators1.pptx
ย 
B.sc CSIT 2nd semester C++ Unit2
B.sc CSIT  2nd semester C++ Unit2B.sc CSIT  2nd semester C++ Unit2
B.sc CSIT 2nd semester C++ Unit2
ย 
2 EPT 162 Lecture 2
2 EPT 162 Lecture 22 EPT 162 Lecture 2
2 EPT 162 Lecture 2
ย 
introduction to c programming and C History.pptx
introduction to c programming and C History.pptxintroduction to c programming and C History.pptx
introduction to c programming and C History.pptx
ย 
ppt on logical/arthimatical/conditional operators
ppt on logical/arthimatical/conditional operatorsppt on logical/arthimatical/conditional operators
ppt on logical/arthimatical/conditional operators
ย 
additional.pptx
additional.pptxadditional.pptx
additional.pptx
ย 
Theory3
Theory3Theory3
Theory3
ย 
Interesting facts on c
Interesting facts on cInteresting facts on c
Interesting facts on c
ย 
C program
C programC program
C program
ย 
C Operators and Control Structures.pdf
C Operators and Control Structures.pdfC Operators and Control Structures.pdf
C Operators and Control Structures.pdf
ย 
Programming presentation
Programming presentationProgramming presentation
Programming presentation
ย 
C++
C++C++
C++
ย 
C++.pptx
C++.pptxC++.pptx
C++.pptx
ย 
Unit i intro-operators
Unit   i intro-operatorsUnit   i intro-operators
Unit i intro-operators
ย 
C-PPT.pdf
C-PPT.pdfC-PPT.pdf
C-PPT.pdf
ย 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
ย 
C Language Part 1
C Language Part 1C Language Part 1
C Language Part 1
ย 
data type.pptxddddswwyertr hai na ki extend kr de la
data type.pptxddddswwyertr hai na ki extend kr de ladata type.pptxddddswwyertr hai na ki extend kr de la
data type.pptxddddswwyertr hai na ki extend kr de la
ย 
Operators-computer programming and utilzation
Operators-computer programming and utilzationOperators-computer programming and utilzation
Operators-computer programming and utilzation
ย 
C Operators and Control Structures.pptx
C Operators and Control Structures.pptxC Operators and Control Structures.pptx
C Operators and Control Structures.pptx
ย 

Recently uploaded

Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
ย 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
ย 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
ย 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
ย 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
ย 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
ย 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdfSuman Jyoti
ย 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .DerechoLaboralIndivi
ย 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spaintimesproduction05
ย 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
ย 
Call Girls in Ramesh Nagar Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
Call Girls in Ramesh Nagar Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort ServiceCall Girls in Ramesh Nagar Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
Call Girls in Ramesh Nagar Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service9953056974 Low Rate Call Girls In Saket, Delhi NCR
ย 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Christo Ananth
ย 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
ย 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
ย 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
ย 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
ย 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
ย 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
ย 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01KreezheaRecto
ย 

Recently uploaded (20)

Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
ย 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
ย 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
ย 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
ย 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
ย 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
ย 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ย 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
ย 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
ย 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spain
ย 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
ย 
Call Girls in Ramesh Nagar Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
Call Girls in Ramesh Nagar Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort ServiceCall Girls in Ramesh Nagar Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
Call Girls in Ramesh Nagar Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
ย 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
ย 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
ย 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
ย 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
ย 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
ย 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
ย 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
ย 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
ย 

Operators

  • 1. Operators in c programming Name : Krishna kumar Pankaj Roll No : 13/IT/22
  • 2. What is Operators ? ๏ต An operator is a symbol that is used to perform certain mathematical or logical operations. ๏ต Operator is used to manipulate data and variables.
  • 3. Types of operators ๏ต In C programming Operators classified in to various categories ๏ต 1. Arithmetic operators ๏ต 2. Relational operators ๏ต 3. Logical operators ๏ต 4. Assignment operators ๏ต 5. Increment & Decrement operators ๏ต 6. Conditional operators ๏ต 7. Bitwise operators ๏ต 8. Special operators
  • 4. Arithmetic operators ๏ต Arithmetic operators used to perform Arithmetic operations. ๏ต There are following Arithmetic operators in c language
  • 5. Example : ๏ต #include<stdio.h> #include<conio.h> int main() { int x=25; int y=5; printf("%d+%d=%dn",x,y,x+y); printf("%d-%d=%dn",x,y,x-y); printf("%d*%d=%dn",x,y,x*y); printf("%d/%d=%dn",x,y,x/y); getch(); } ๏ต Output : 25+5=30 25-5=20 25*5=125 25/5=5
  • 6. Relational operators ๏ต Relational operators compare between two operands and return in terms of true or false ๏ต There are following Relational operators.
  • 7. Example : #include<conio.h> #include<stdio.h> int main() { int a, b; printf("Enter values for a and b : "); scanf("%d%d",&a,&b); printf("n The < value of a is %d", a<b); printf("n The <= value of a is %d", a<=b); printf("n The > value of a is %d", a>b); printf("n The >= value of a is %d", a>=b); printf("n The == value of a is %d", a==b); printf("n The != value of a is %d", a!=b); getch(); ๏ต }
  • 8. Logical operator ๏ต A Logical operator is used to compare or evaluate logical or relational operations. ๏ต There are following logical operators
  • 9. Example : #include<stdio.h> #include<conio.h> int main() { int a, b; printf("Enter values for a and b : "); scanf("%d%d", &a, &b); printf("n %d",(a<b)&&(a!=b)); printf("n %d",(a<b)||(b<a)); printf("n %d",!(a==b)); getch(); }
  • 10. Assignment operator ๏ต An Assignment operator is used to assign a constant or a value of one variable to another. ๏ต = is an Assignment operator. ๏ต you can use the assignment for multiple assignment as follows: ๏ต x=y=z=20;
  • 11. Increment Operator(++) ๏ƒ˜ Increment operator are increase the value of subsequent ๏ƒ˜ Increment operator are two types as follows: โ€ข post Increment โ€ข Ex : x=5;x++;x=5 โ€ข pre Increment โ€ข x=5;++x;x=6
  • 12. Decrement operator(--) ๏ต Decrement operator Decrease the value to one ,two and so on. ๏ต Decrement operator are also two type as โ€ข Post Decrement โ€ข x=5;x--;x=5 โ€ข pre decrement โ€ข x=5;--x;x=4
  • 13. Example of Increment & Decrement operator #include<stdio.h> #include<conio.h> int main() { int a,b,c; printf("Enter the values for a and b :"); scanf("%d%d", &a, &b); printf("n The value of c is %d", c=++a); printf("n The value of c is %d", c=a++); printf("n The value of c is %d", c=--b); printf("n The value of c is %d", c=b--); } ๏ต Output Enter the value of a and b : 3 ,7 The value of c is 4 The value of c is 4 The value of c is 6 The value of c is 6
  • 14. Conditional operator ๏ƒ˜ They are also called as ternary operator. ๏ƒ˜ They are also called as ?: operator. ๏ƒ˜ Ternary operator Takes on 3 Argument Where 1) Expression 1 is condition 2) Expression2 is Statement Followed if Condition is True 3) Expression2 is Statement Followed if Condition is False True Condition ? Block 1 : Block 2 False
  • 15. Example : #include<stdio.h> void main() { int a, b, x; printf("Enter the values of a add b : "); scanf("%d %d", &a, &b); x=(a>b)?a:b; printf("Biggest Value is :%d",x); }
  • 16. Bitwise Operator ๏ต One of the C powerful Features is a set of bit manipulation operators ๏ต There are various Bitwise Operators in C as following Table. 1. & (bitwise AND) Takes two numbers as operand and does AND on every bit of two numbers. The result of AND is 1 only if both bits are 1. 2. | (bitwise OR) Takes two numbers as operand and does OR on every bit of two numbers. The result of OR is 1 any of the two bits is 1. 3. ^ (bitwise XOR) Takes two numbers as operand and does XOR on every bit of two numbers. The result of XOR is 1 if the two bits are different. 4. << (left shift) Takes two numbers, left shifts the bits of first operand, the second operand decides the number of places to shift. 5. >> (right shift) Takes two numbers, right shifts the bits of first operand, the second operand decides the number of places to shift. 6. ~ (bitwise NOT) Takes one number and inverts all bits of it
  • 17. Special Operator ๏ต There are many special operators use in c programming. ๏ต Comma operator ๏ต Sizeof Operator
  • 18. Comma Operator ๏ต Evaluate of comma operator โ€“ Left to Right ๏ต Uses of comma operator as following : ๏ต Multiples Declaration ๏ต Multiples Initialization ๏ต Multiples Variation ๏ต Multiples Statement ๏ต Example of comma operator ๏ต X=12,y=10,z=18 ๏ต For( i=0,j=0;i<5,j<5;i++,j++ )
  • 19. Sizeof operator ๏ต Sizeof operator calculate the size of data ๏ต i.e: How many bit a specific data having. ๏ต Syntax of sizeof operator: ๏ต Sizeof(variable); Example : sizeof(a), where a is interger, will return 4
  • 20. Thank you Any Queries ??? Go to Google Or Email me at โ€œKrishna.pankaj@hotmail.comโ€