Best Services Buy

Saturday, 3 September 2016

Operators in C

There are many types of operators in C
1) Arithmetic operator: –
2) Increment and Decrement operator: –
3) Assignment operator: –
4) Relational operator: –
5) Logical operator: –
6) Bitwise operator: –

1) Arithmetic operator: –

Arithmetic operator are used for addition, subtraction, multiplication, division and modulus (to find remainder) of any number
Operators Meaning of Operators
+ Addition of two or more numbers
Subtraction of two or more numbers
* Multiplication of two or more numbers
/ Division of two or more numbers
% Remainder after division(modulo division)
Example: –
//Write a program to print sum, subtract, multiply,
division of two number
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf(“Enter the two number “);
scanf("%d %d",&a, &b);
c=a+b;
printf("\n sum of two number = %d ",c);
c=a-b;
printf("\n Subtraction of two number = %d ",c);
c=a*b;
printf("\n Multiplication of two number = %d ",c);
c=a/b;
printf("\n Division of two number = %d ",c);
getch();
}

No comments:

Post a Comment