Arithmetic Operators: These are used to perform arithmetic/mathematical operations on operands.
- Addition: The ‘+’ operator adds two operands. For example, x+y.
- Subtraction: The ‘-‘ operator subtracts two operands. For example, x-y.
- Multiplication: The ‘*’ operator multiplies two operands. For example, x*y.
- Division: The ‘/’ operator divides the first operand by the second. For example, x/y.
- Modulus: The ‘%’ operator returns the remainder when first operand is divided by the second. For example, x%y.
Program
#include<stdio.h>
void main()
{
int a,b,c,d,f,g,h;
printf("Enter first number ");
scanf("%d",&a);
printf("Enter Second number ");
scanf("%d",&b);
c=a+b;
printf("Sum %d ",c);
d=a-b;
printf("\nDifference %d ",d);
f=a*b;
printf("\nProduct %d ",f);
g=a/b;
printf("\nDiv %d ",g);
h=a%b;
printf("\nMod %d \n",h);
}
No comments:
Post a Comment