This operator result always figure out in two condition that it will be either true or False. let’s say If we want to check that is one operand is equal to or greater than other operands, then we use >= operator. The Relational operators in C language used to compare or relation between the values of two operands. pre-decrement example: res is assigned 10 only Printf("a is %d and res is %d\n", a, res) pre-increment example: res is assigned 11 now since a is updated here itself post-decrement example: res is assigned 11 only, a is not updated yet Printf("a is %d and res is %d\n", a, res) // a becomes 11 now post-increment example:/ res is assigned 10 only, a is not updated yet Value of b is decremented after assigning it to variable b.Įxample: Arithmetic Unary operators // C program to use Unary arithmetic operators Value of a is decremented before assigning it to variable a. Value of b is incremented after assigning it to variable b. Value of a is incremented before assigning it to variable a. The Unary operators can also be used in format of Pre and Post increment and decrement. Printf("Remainder of a divided by b = %d \n", c) Ĭ Program using arithmetic Unary operators Printf("Multiplication of a*b = %d \n", c) The ‘ – – ‘ operator is used to decrement the value of an integer. The ‘++’ operator is used to increment the value of an integer. The ‘%’ operator returns the remainder when first operand is divided by the second ( x%y). The ‘/’ operator divides the first operand by the second ( x/y). The ‘*’ operator multiplies two operands ( x*y). The ‘-‘ operator subtracts two operands ( a-b). The ‘+’ operator adds two operands ( a+b). Algebraic Expression Vs C Expression for Arithmetic operators.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |