Created
October 31, 2014 13:50
-
-
Save msomu/50c4f592cf0ef392799a to your computer and use it in GitHub Desktop.
Som basic maths operations on Java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Scanner; | |
| public class MathOperators { | |
| public static void main(String []args){ | |
| Scanner sc = new Scanner(System.in); | |
| int girls,boys,people; | |
| girls = sc.nextInt(); | |
| boys= sc.nextInt(); | |
| // Addition | |
| people = boys + girls; | |
| System.out.println(people); | |
| // Sub | |
| people = boys - girls; | |
| System.out.println(people); | |
| // Multiply | |
| people = boys * girls; | |
| System.out.println(people); | |
| // Divide | |
| people = boys / girls; | |
| System.out.println(people); | |
| // Divide | |
| people = boys % girls; | |
| System.out.println(people); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 3 | |
| 6 | |
| 9 | |
| 3 | |
| 18 | |
| 2 | |
| 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment