0% found this document useful (0 votes)
3 views9 pages

CSE Presentation

The document provides an overview of operators in programming, including arithmetic, relational, and logical operators. It explains their functions, classifications, and provides code examples for each type of operator. The document serves as a guide for understanding how these operators perform operations on variables and values.

Uploaded by

arghyaroy0011
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views9 pages

CSE Presentation

The document provides an overview of operators in programming, including arithmetic, relational, and logical operators. It explains their functions, classifications, and provides code examples for each type of operator. The document serves as a guide for understanding how these operators perform operations on variables and values.

Uploaded by

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

Understanding

Operators
Arithmetic,Relational & Logical

Submitted To: Presented by:


Md. Lysuzzaman XYZ
Lecturer Reg No. : 2023331503
Computer Science & Engineering XYZ
Sylhet Engineering College Reg No. : 2023331520
XYZ
Reg No. : 2023331534
Table of contents

01 02
Operators Arithmetic Operators
Operators are symbols that Used for mathematical calculations
perform operations on variables like addition, subtraction,
and values in programming. multiplication, and division.

03 04
Relational Operators Logical Operators
Used for comparing values and Used to combine multiple
determining conditions conditions in programming.
(true/false).
Introduction To Operators
Operators are symbols that perform operations on Example:
variables and values.They help in mathematical #include <stdio.h>
calculations, comparisons, and logical decisions in
programming. int main() {
int a = 10, b = 5;
printf("Sum: %d\n", a + b);
printf("Is a greater than b? %d\n", a > b);
Keywords:
1. Operand: Symbol that operators act.(e.g a & b) return 0;
2. Operator: The symbol that performs the operation. }
(e.g +,>)
3. Expression: A combination of operators and Output:
operands.(e.g a + b)
Sum: 15
Is a greater than b? 1
Arithmetic Operators
Performs basic arithmetic operations like Example:
Subtraction, Addition, Multiplication and Division. #include <stdio.h>
int main() {
int a = 10, b = 5;
// Arithmetic operations
printf("Addition: %d + %d = %d\n", a, b, a + b);
Keywords:
printf("Subtraction: %d - %d = %d\n", a, b, a - b);
1. Addition: + printf("Multiplication: %d * %d = %d\n", a, b, a * b);
2. Subtraction : - printf("Division: %d / %d = %d\n", a, b, a / b);
3. Multiplication : * printf("Modulus: %d %% %d = %d\n", a, b, a % b);
4. Division: / return 0;
5. Remainder: % }
Output:
Addition: 10 + 5 = 15
Subtraction: 10 - 5 = 5
Multiplication: 10 * 5 = 50
Division: 10 / 5 = 2
Modulus: 10 % 5 = 0
Classification of Arithmetic Operations
There are three types of arithmetic operations. Example:
Integer Arithmetic, Real Arithmetic, Mixed-Mode #include <stdio.h>
Arithmetic. int main() {
int a = 5, b = 3;
float x = 5.5, y = 3.2;
// Integer Arithmetic
Keywords: printf("Integer Addition: %d + %d = %d\n", a, b, a + b);
1. Integer Arithmetic: All operations remain in integer // Real Arithmetic
form (e.g., 5 + 3 = 8). printf("Real Addition: %.2f + %.2f = %.2f\n", x, y, x + y);
2. Real Arithmetic: Operations involve floating-point // Mixed-Mode Arithmetic
float result = a * x;
numbers (e.g., 5.5 + 3.2 = 8.7).
printf("Mixed-Mode Multiplication: %d * %.2f = %.2f\n", a, x,
3. Mixed-Mode Arithmetic: Operations with both integer result);
and float types result in a float (e.g., 5 * 5.5 = 27.5). return 0;
}
Output:
Integer Addition: 5 + 3 = 8
Real Addition : 5.5 + 3.2 = 8.7
Mixed-Mode Multiplication: 5 * 5.5 = 27.5
Relational Operators
Relational Operators are used to compare Example:
Two values or expressions. These operators #include <stdio.h>
int main() {
evaluate the relationship between the values and
int a = 10, b = 5;
return a boolean result. // Relational operations
printf("Is a equal to b? %d\n", a == b);
Keywords: printf("Is a not equal to b? %d\n", a != b);
printf("Is a greater than b? %d\n", a > b);
1. Equal To: == printf("Is a less than b? %d\n", a < b);
2. Not Equal To: != printf("Is a greater than or equal to b? %d\n", a >= b);
3. Greater Than: > printf("Is a less than or equal to b? %d\n", a <= b);
return 0;
4. Less Than: <
}
5. Greater than or Equal to : >=
Output:
6. Less than or Equal to : <=
Is a equal to b? 0
Is a not equal to b? 1
Is a greater than b? 1
Is a less than b? 0
Is a greater than or equal to b? 1
Is a less than or equal to b? 0
Logical Operators
Logical operators combine multiple boolean Example:
expressions using AND, OR, & NOT to create a #include <stdio.h>
single boolean value based on those
comparisons. int main() {
int a = 10, b = 5, c = 3;
printf("Is a greater than b & b greater than c? %d\n",(a>b) && (b
Keywords:
> c));
1. AND: (&&) Logical AND (both conditions must be true) printf("Is a less than b OR a greater than c? %d\n",(a<b)||(a >
2. OR: (||) Logical OR (at least one condition must be c));
true) printf("Is a NOT greater than b? %d\n", !(a > b));
3. NOT: (!) Logical NOT (negates the condition)
return 0;
}
Output:
Is a greater than b & b greater than c? 1
Is a less than b OR a greater than c? 1
Is a NOT greater than b? 0
Any Questions?
Thank You for
staying with
us.

You might also like