Arithmetic operator:-

An arithmetic operator is a mathematical function that takes two operands and performs a calculation on them. They are used in common arithmetic and most computer languages contain a set of such operators that can be used within equations to perform a number of types of sequential calculation. Basic arithmetic operators include:



1.Write a Program for following example.
A cashier has currency notes of denominations 10, 50 and 100. If the amount to be withdrawn is input through the keyboard in hundreds, find the total number of currency notes of each denomination the cashier will have to give to the withdrawer.

#include <stdio.h>                                                                     
void main ()                                                                            
{                                                                                        
  int a, b, c, UserIP;                                                                    
  printf ("Enter the withdrawn amount in the multiple of Hundred:");
  scanf ("%d", &UserIP);
  a = UserIP / 10;
  b = UserIP / 50;
  c = UserIP / 100;
  printf("The %d amount is available in the multiple of Rs.10,Rs.50 & Rs.100\n",UserIP);
  printf ("The number of Notes for Rs.10 is %d\n", a);
  printf ("The number of Notes for Rs.50 is %d\n", b);
  printf ("The number of Notes for Rs.100 is %d\n", c);
}

Output:-


2.Write a Program for arithmetic operations using operators in C.

#include<stdio.h>
void main()
{
    int a,b;
    printf("Enter the First Number=");
    scanf("%d",&a);
    printf("Enter the Second Number=");
    scanf("%d",&b);
    printf("Addition of %d & %d is %d\n",a,b,a+b);
    printf("Substraction of %d & %d is %d\n",a,b,a-b);
    printf("Multiplication of %d & %d is %d\n",a,b,a*b);
    printf("Division of %d & %d is %f\n",a,b,(float)a/b);
    printf("Remainder of %d & %d is %d\n",a,b,a%b);
    printf("Pre-Increment of %d is ",a); 
    printf("%d\n",++a);
    a=--a;
    printf("Post-Increment of %d is ",a); 
    printf("%d\n",a++);
    a=--a;
    printf("Pre-Decrement of %d is ",a); 
    printf("%d\n",--a);
    a=++a;
    printf("Post-Decrement of %d is ",a); 
    printf("%d\n",a--);

}

Output:-