Addition (+)
Addition is the basic operation of arithemetic. In its simplest form, addition combines two numbers, the addends or terms, into a single number, the sum of the numbers
Subtraction (−)
Subtraction is the opposite of addition. Subtraction finds the difference between two numbers, the minuend minus the subtrahend. If the minuend is larger than the subtrahend, the difference is positive; if the minuend is smaller than the subtrahend, the difference is negative; if they are equal, the difference is zero.
Multiplication (×, ·, or *)
Multiplication is the second basic operation of arithmetic. Multiplication also combines two numbers into a single number, the product. The two original numbers are called the multiplier and the multiplicand, sometimes both simply called factors.
Division (÷ or /)
Division is essentially the opposite of multiplication. Division finds the quotient of two numbers, the dividend divided by the divisor. Any dividend divided by zero is undefined. For positive numbers, if the dividend is larger than the divisor, the quotient is greater than one, otherwise it is less than one (a similar rule applies for negative numbers). The quotient multiplied by the divisor always yields the dividend.
----------------------------------------------------------------------------------------------
A C PROGRAM TO IMPLEMENT ARITHMETIC OPERATIONS-WITH & WITHOUT POINTERS
COMPILER EMPLOYED: DEV C++ COMPILER-4.9.9.2
SOURCE FILE SIZE :2 kb
EXE FILE SIZE :22 kb
NOTE: PLEASE INCLUDE THE DESIRED HEADER FILE
---------------------------------------------------------------------------------------------
C PROGRAM SOURCE & EXE DOWNLOAD:
Click download button to download
DISCLAIMER: The following program cannot be ensured of perfection.so any flaws in the program can be notified in the comments section.
----------------------------------------------------------------------------------------------
CODE:
int main()
{
int OPT,IN1,IN2,*A,*B,CH;
do
{
printf("\n ARITHMETIC OPERATIONS...");
printf("\n MENU");
printf("\n [1].ADDITION");
printf("\n [2].SUBTRACTION");
printf("\n [3].MULTIPLICATION");
printf("\n [4].DIVISION");
printf("\n OPTION:");
scanf("%d",&OPT);
printf("\n ENTER INPUTS");
printf("\n INPUT 1:");
scanf("%d",&IN1);
printf("\n INPUT 2:");
scanf("%d",&IN2);
switch(OPT)
{
case 1 :
printf("\n ADDITION");
printf("\n COMPUTING WITHOUT POINTERS");
printf("\n SUM:%d",IN1+IN2);
printf("\n COMPUTING WITH POINTERS");
A=&IN1;
B=&IN2;
printf("\n SUM:%d",*A+*B);
break;
case 2 :
printf("\n SUBTRACTION");
printf("\n COMPUTING WITHOUT POINTERS");
printf("\n DIFFERENCE:%d",IN1-IN2);
printf("\n COMPUTING WITH POINTERS");
A=&IN1;
B=&IN2;
printf("\n DIFFERENCE:%d",*A-*B);
break;
case 3 :
printf("\n MULTIPLICATION");
printf("\n COMPUTING WITHOUT POINTERS");
printf("\n PRODUCT:%d",IN1*IN2);
printf("\n COMPUTING WITH POINTERS");
A=&IN1;
B=&IN2;
printf("\n PRODUCT:%d",*A**B);
break;
case 4 :
printf("\n COMPUTING WITHOUT POINTERS");
printf("\n QUOTIENT:%d",IN1/IN2);
printf("\n COMPUTING WITH POINTERS");
A=&IN1;
B=&IN2;
printf("\n QUOTIENT:%d",*A/ *B);
break;
default :
printf("\n INVALID CHOICE");
break;
}
printf("\n DO YOU WISH TO CONTINUE? 1~2:");
printf("\n OPTION:");
scanf("%d",&CH);
}while(CH==1);
printf("\n THANK YOU");
return 0;
}
----------------------------------------------------------------------------------------------
Your's friendly,
[MOHANRAM.G],
ADMIN...
0 comments:
Post a Comment