Enter it as above and Make it.
Explanation of Example 2
Three int variables are declared. A and B are assigned values, then total is assigned the sum of A and B.
Before running this example
Here's a little tip to save time when running Command Line applications.When you run this program from the Command Line. It should output "The number is 22".
Other Arithemetic Operations
As well as addition, you can do subtraction, multiplication and division. Just use + for addition, - for subtraction, * for multiplication and / for division.Try changing the above program- use subtraction or multiplication. You can also change ints to floats or doubles and change %d to %f.
With floats you have no control over how many decimal points are displayed.
On the next page : Learn about output formats.


