 Dear Lana, today I am going to discuss the topic operators and expressions. This topic is from the course computer programming using C-language. Today I am going to discuss mainly the definition of operators, the definition of expressions, what are the different types of operators using C-language and the precedence and associativity of operators. Now, what is operator? Suppose an operator is defined as a symbol that specifies the mathematical, logical or relational operators to be performed. C-language supports various types of operators and now let me discuss what is operator and what is operand. Suppose I have written a statement a plus b here this a and b these are known as operands and this is a this is an operator it is a plus symbol is a binary operator because it operates on two operands that is why it is known as a binary operator similarly minas division, modulus multiplication these are all binary operators and what is unary operator unary operator operates unary operator operates only on single operand I have written this statement a plus plus here this increment operator is a unary operator because it operates only on single operand this is operator that means operator is a symbol. Now what is expression? An expression is a combination of variables constants and operators written according to the syntax of the language. In C-language every expression evaluates to a value that is every expression results in some value of a certain type and that can be assigned to a variable. Let me write an expression a plus b this is an expression result of these two variables is stored in this variable sum this is an expression it is a combination of operators and operands and sometimes constants. Now I am going to discuss the types of operators C-language supports various types of operators and those are first one is arithmetic operator arithmetic operator next logical operator relational operator, convolutional operator, midrange operator, union operator, size of operator, unary operator, unary operator which includes increment and decrement of operator increment and decrement of operator these are the operators used in C-language. Now let me discuss the arithmetic operators arithmetic operators can be applied to any integer and floating point numbers. The addition, subtraction, multiplication, division these arithmetic operators perform the usual arithmetic operation in C-programs but the modulus operator performs differently. Modulus operator is denoted by the percentage symbol and it gives the remainder of the division and division operator gives the result of a division. Let me discuss with an example this is modulus operator this is an example of arithmetic operator and this is denoted by this symbol percentage. Suppose 5 it gives means it gives the remainder this division operator division operator is denoted by this symbol and suppose 5 divided by 2 it will give 2 result of this one division operator this value and this modulus operator gives this value remainder of a division. So dear learner I have listed all the arithmetic operators in a table let me discuss that. Suppose I have taken 5 in the variable a and 2 in the variable b then the plus operator gives a plus b equal to 7. Similarly the subtraction operator gives m minus b 5 minus 2 equal to 3 multiplication gives a into b that means it will result 10. Similarly division operator gives the result of a division that means 5 divided by 2 it will give 2 and the modulus operator gives the remainder of a of a division a mod b equal to 1. I have written the use of all this arithmetic operators in a simple C-program it is written in this C-program here in this C-program initially I have declared 2 variables n1 and n2 for storing the numbers. Then there are some other variables like sum, sub, MUL, mal then division and mod to store the result of this arithmetic operators. First I have entered the value of 2 variables in the variable n1 and n2 then in the sum variable the addition is stored then in the next next statement the summation is displayed with the help of the printf statement after that sub equal to n1 minus n2 that means the subtraction of the two numbers is stored in this variable sub. After that the difference is displayed with the help of a printf statement like this the multiplication division and modulus is calculated and the output of this program is like this. Here the input numbers are 10 and 3 the sum is 13 the difference is 7 the product is 30 and division is 3 and the modulus is 1. This is a simple example of a C-program where I have shown the all the uses of arithmetic operators. Relational operator can be used to determine the relationship between the operands. A relational operator is also known as the comparison operator. Relational operator returns true or false depending on whether the conditional relationship between the two operands holds or not. True means the value 1 and false means the value 0. Suppose I have taken an expression x less than y if x is less than y it gives true value that means 1. If x is greater than y then it gives false value and that is it will give 0. Here I have shown all the relational operators in a tabular format first one is less than second one is less than or equal to third one is greater than fourth one is greater than or equal to then equal to operator then not equal to operator. Equal to operator is expressed with double equal to sign and with the help of single equal to sign we in C language only assignment operator is expressed. Here I have shown some examples 4.5 less than equal to 12. As 4.5 is small as compared to 12 so it is a true statement so it gives true value that means 1. Similarly minus 6 is greater than 0 it is a false statement because minus 6 is always less than 0 so it will result 0. Similarly 10 less than 7 plus 5 here 7 plus 5 is calculated first 7 plus 5 is equal to 12 10 less than 12 it is true so it will give 1 and in the next statement 4 is equal to 2 it is false so it gives 0 value. Now I will discuss the logical operators. There are 3 logical operators in C language these are logical and which is denoted by this Davoon Apartheon symbol then logical or which is denoted by 5 logical not this is denoted by this negation symbol. These are the 3 logical operators used in C language. Logical and operator is used to simultaneously evaluate 2 conditions with relational operators. If the condition on both sides of the logical operator is true then the whole expression is true. Suppose I have written a statement if A greater than B and A greater than C then I will store the maximum value on this variable max. In this expression this is an expression this is the left hand side of an expression this is the right hand side then of an expression and this is the logical and operator. If both these conditions are true suppose A is greater than B and suppose this is also true and suppose this is also true then only A is assigned to max both conditions should be true in case of logical and if one is false if this condition is false or this condition is true then it will not come to this statement. In logical and operator both conditions should be true and the truth table for logical and operator is like this. Suppose this is the first expression this is the second expression and this is A and B. Suppose first expression is 0 that means false second expression is also 0 then after logical and the result will be 0 first expression is false second expression is suppose true that is 1 then the result will be also 0 first expression is true 1 second expression is 0 then the result will be 0 if both the expressions are true then only result will be 1. This is the truth table for logical and operator. In logical or operator if one or both the conditions on the left hand side and the right side of the logical operator is true then the whole expression is true. In logical or operator if one or both the conditions on the left hand side and right hand side of the logical operator is true then only the whole expression is true. Suppose in this expression I am modifying this with the logical or operator in case of logical or operator only left hand side or right hand side only one condition is necessary to be true. Suppose this is true this is false then max will be sorry the result will be true that means 1. If I express this in this truth table for or operator here this result will be sense like this 0 0 it will give false value 0 0 1 that means false and true it will give a true value and true and false it will also give a true value and true true it will also give true value. Only one expression is required to be true in case of logical or operator and the third operator and the third operator is logical not this is noted by this symbol. Suppose a is a number and not a suppose this is the truth table for logical not suppose a is 0 then if only reverse the number it will be 1 suppose a is true it will reverse this like this it will be false this is the logical not operator that is logical not produces a 0 if the expression evaluates to a non-zero value and produces a 1 if the expression produces a 0 value. Now I am coming to assignment operators assignment operators I have already told that the single equal sign is denoted is used for assignment operator and double equal sign is used for equal to sign assignment operator is used to assign a value to a variable suppose I want to assign a value to a variable this is the assignment operator and this is the equal to operator suppose I want to assign a value to a variable suppose I have declared a variable like this integer a suppose a equal to 20 that means 20 is assigned to a the value 20 is assigned to a this variable stores the value 20 similarly suppose I have in the next step when I have written 40 that means 40 is assigned to new value of a is 40 then 40 is assigned to a this is the use of assignment operator the assignment operator equal to and the equality of operator double equal to are definitely distinctly different the assignment operator is used to assign a value to a variable whereas the equality operator is used to determine if the two expression have the same value there are some short hand assignment operators that means we can write a single statement in different way let me show this in a tabular format here a equal to a plus 1 that means 1 is added to a and this value is assigned to the variable a this can be written as a plus equal to 1 in the next statement a equal to a minus 1 is same as a minus equal 1 in the same way the last statement a equal to a mod b in this statement it can be written as a mod equal to b these are shortcut operators assignment operators we can write this statement in a different way like this now let me discuss what is conditional operator conditional operator is a tarnary operator because it uses three operands the syntax of writing a conditional operator is like this let me write the syntax expression 1 expression 2 expression 3 and is this combination of this two statement this is the symbol of conditional operator this is the syntax if this expression or condition is true if this condition is true it will result this way and if this condition is false it will give this way in this way the this conditional operator works here three operands are used this expression and this expression and this expression so it is known as tarnary operator because there are three operands let me take an example a equal to 10 b equal to 15 that means 10 is assigned to a and 15 is assigned to b then in the next statement x equal to a greater than b I have used this question mark then a then colon then b and then after that a semicolon here value of b will be assigned to x because b is 15 and a is 10 a greater than b is false because 10 is less than 15 so it will give the third part that means expression 3 and which is here b the value 15 will be the output of this two statement I have written one example to describe the use of conditional operator here in this program it will display whether the user is eligible for 4 or not if the age is greater than equal to 18 then the user will be eligible for 4 otherwise you will not be able to 4 for this program I have written this main part I have declared first one a variable integer is in this output statement enter your age in years when the user enters his age with the help of this input statement scan f then age will be stored in this variable age after that a conditional statement operator statement is used here in this statement if age is greater than equal to 18 then first symbol is used question mark print f you can vote then I have used one colon print print f you cannot vote if this condition a is greater than equal to 18 if this condition is true then the first part you can vote will be displayed if this condition is false then the second part you cannot vote will be displayed if the user enters suppose 24 as an input then the first statement you can vote will be the output of this program if the he enters suppose 15 that means his age is 15 then you cannot vote will be displayed this is simple program for determining whether a person is eligible for 4 or not in the next class I will discuss unary operator binary operator then bitwise operator comma operator and size of operator after that I will discuss one important topic which is precision and associativity operator thank you