Using Arithmetic Operators To Perform Calculations On C / C ++ Languages

in #utopian-io7 years ago (edited)

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
1.png


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
2.png


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
3.png


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

4.png

Finish
Thank you visit my article.

@cuthamza



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Hey @cuthamza I am @utopian-io. I have just upvoted you!

Achievements

  • Seems like you contribute quite often. AMAZING!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

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

You're so nice for commenting on this post. For that, I gave you a vote!

Nice my friend good work on steemit

Saling sharing nice

nice my boyfriend, don't forget me your peng

I am forget peng

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Coin Marketplace

STEEM 0.18
TRX 0.16
JST 0.030
BTC 62410.74
ETH 2445.09
USDT 1.00
SBD 2.67