About Me

Hey friends! My name is yuvraj basnet. I'm going to introduce myself.I have born and grown up in india(chandigarh) and I'm studying second year of B.C.A computer science field. My father serving in indian air force. My mother has been taking care of house hold. I am a friendly person, good thinker, I can work for longer hours without any break, only if I'm interested in that...My life style is very simple.

PART I OPERATORS IN C

In this tutorial I will explain the operators in detail with examples. 


   

                                       OPERATORS
Operators in C language can be defined as symbols that helps us to perform specific mathematical and logical computations on operands.

For Example- + is an operator to perform addition.

C has wide range of operators to perform various operations.

1)ARTHIMETIC OPERATORS:

An arithmetic operators performs mathematical operations such as addition, subtraction, division and multiplication on numerical values.



Arithmetic operator are of two types namely Binary which operates on two operands and unary operates on single operand.

i)BINARY OPERATORS-

Assignment (‘=’): used to assign Lvalue (left-hand-side value) to Rvalue (right-hand-side value). for example, c = a+b;

Addition (‘+’): used to adds two operands or variables or numerical values. For example, c=a+b.

Subtraction (‘-’): The minus operator used to subtract two operands. For example, c=a-b.

Multiplication (‘*’): Used to multiply two operands. For example, c=a*b.

Division (‘/’): divides the first operand ‘a’ by the second operand ‘b’. For example, c=a/b.

Modulus (‘%’): Return the remainder when first operand is divided by the             second. For example, c=a%b.

 Example-                         
    OUTPUT




ii)UNARY OPERATORS:

A) Increment Operator(‘++’): ++’ operator used to increase the value of an integer or variable by one i.e. ++x is similar to x=x+1.

pre-increment: When ++ is placed before the variable is called pre-increment and its value is incremented instantly and then assigned or used. For example, ++x.


post-increment: when ++ is placed after the variable it is called post-increment and its value is first used than incremented for next statement. For example, x++.
B) Decrement Operators(‘–’): ‘–’ operator used to decrease the value of an integer or variable by one i.e. –x is similar to x=x-1.
pre-decrement: When — is placed before the variable is called pre-decrement and its value is decremented instantly and then assigned or used. For example, –x.
post-decrement: when — is placed after the variable it is called post-decrement and its value is first used than incremented for next statement. For example,


  •     OUTPUT  




                
               

























Post a Comment

0 Comments