In order to perform some basic
calculation we need these arithmetic operators , these are nothing but our old
arithmetic operations like addition , subtraction , multiplication and division
, there is not much to say about them , so let see some examples to make it clear
main()
{
int a , b; //we can declare multiple variable at a same time like
this
int add,sub,mul,div;
printf("\n===============================\n");
printf("Pl Enter Your First Number......");
scanf("%d",&a);
printf("Pl Enter Your Second Number.....");
scanf("%d",&b);
printf("\n===============================\n");
add = a + b; // adding two numbers
printf("Addition of %d and %d is .......%d",a,b,add);
printf("\n===============================\n");
sub = a - b; //subtracting two numbers
printf("Subtraction of %d and %d is .....%d",a,b,sub);
printf("\n===============================\n");
mul = a * b; //multiplying
two numbers
printf("Multiplication of %d and %d is ..%d",a,b,mul);
printf("\n===============================\n");
div = a / b; //dividing two number
printf("Division of %d and %d is ........%d",a,b,div);
printf("\n===============================\n");
getch();
}
This program accepts two number
from user and performs 4 basic
arithmetic operations on them
No comments:
Post a Comment