Skip to content

Instantly share code, notes, and snippets.

@msomu
Created October 31, 2014 13:50
Show Gist options
  • Select an option

  • Save msomu/50c4f592cf0ef392799a to your computer and use it in GitHub Desktop.

Select an option

Save msomu/50c4f592cf0ef392799a to your computer and use it in GitHub Desktop.
Som basic maths operations on Java
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);
}
}
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