What Will I Learn?
Implementing Arithmetic Operators in C / C ++
Requirements
DEV C++ 5
Difficulty
- Intermediate
Tutorial Contents
Use Arithmetic Operators To Perform Calculations On C Language
Operator
The operator is controlling the operation to be performed on some time forming anexpression. In General, in an expression of an operator which is two time.
For example the expression:
a + b
a and b
are the three, while
" + "
is the operator
c - d
c and d
are the three, while
" - "
is the operator
p * q
p and q
are the three, while
" * "
is the operator
x / y
x and y
are the three, while
" / "
is the operator
Operator Aritmatik
These operators form a calculation aritmatik. The second time of this aritmatik operation can be either integer or real.
The operator of this type are:
+ = Summation
- = Reduction
* = Multiplication
/ = Division
The output of the aritmatik operation will have the same data type data type of both operand.
For example, if an integer integer integer numbers with other aggregated then the output is an integer number as well.
In addition it should be noted also that a aritmatik operator can not be applied to two numbers with a different data type.
The example program with operation aritmatik:
A.Use for summation
#include
using namespace std;
main () {
int number_a = 62;
int number_b = 9;
int results;
results = number_a + number_b;
printf ("Practical Summation Operator by cuthamza \n\n");
printf ("Results %d +% d = %d \n", number_a, number_b, results);
}
The above program will return the value of the results of calculations in accordance with the input. For example, in the first of our input number_a input 62 and the second number_b we input 9 then the result is 71. the output is:
number_a = 62
number_b = 9
The results of the calculations of 62 + 9 = 71
B.Use for reduction
#include
using namespace std;
main () {
int number_c = 80;
int number_d = 30;
int results;
results = number_c-number_d;
printf ("Practical Operator Reduction by cuthamza \n\n");
printf ("Results %d - %d = %d \n", number_c, number_d, results);
}
The above program will return the value of the result of the reduction in accordance with the input. For example, in the first of our input number_c input 80 and the second number_d we input the result is 30 and 50. the output is:
number_c = 80
number_d = 30
The summation of results 80-30 = 50
C.Use for multiplication
#include
using namespace std;
main () {
int number_p = 50;
int number_q = 10;
int results;
results = number_p * number_q;
printf ("Practical Operator multiplication by cuthamza \n\n");
printf ("Results %d *% d = %d \n", number_p, number_q, results);
}
The above program will return the value of the multiplication results in accordance with the input. For example, in the first of our input number_p input 50 and the second number_q we input 10 then the result is 500. the output is:
number_p = 50
number_q = 10
The results of the calculations of 50 * 10 = 500
D.The use for the Division
#include
using namespace std;
main () {
int number_x = 90;
int number_y = 15;
int results;
results = number_x/number_y;
printf ("Practical Operator Division by cuthamza \n\n");
printf ("Results %d /% d = %d \n", number_x, number_y, results);
}
The above program will return the value of the results in accordance with the Division of the input. For example, in the first of our input number_x input 90 and the second number_y we input the 15 then the result is 6. the output is:
number_x = 90
number_y = 15
The results of the calculations of 90/15 = 6
Finish
Thank you visit my article.
Posted on Utopian.io - Rewarding Open Source Contributors
Hey @cuthamza I am @utopian-io. I have just upvoted you!
Achievements
Suggestions
Get Noticed!
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
You're so nice for commenting on this post. For that, I gave you a vote!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Nice my friend good work on steemit
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Saling sharing nice
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
nice my boyfriend, don't forget me your peng
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
I am forget peng
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit