September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,15 +1,16 @@
|
|||
import java.util.Scanner;
|
||||
public class Int{
|
||||
public static void main(String[] args){
|
||||
Scanner sc = new Scanner(System.in);
|
||||
int a = sc.nextInt();
|
||||
int b = sc.nextInt();
|
||||
|
||||
int sum = a + b;//integer addition is discouraged in print statements due to confusion with String concatenation
|
||||
System.out.println("a + b = " + sum);
|
||||
System.out.println("a - b = " + (a - b));
|
||||
System.out.println("a * b = " + (a * b));
|
||||
System.out.println("quotient of a / b = " + (a / b)); // truncates towards 0
|
||||
System.out.println("remainder of a / b = " + (a % b)); // same sign as first operand
|
||||
}
|
||||
public class IntegerArithmetic {
|
||||
public static void main(String[] args) {
|
||||
Scanner sc = new Scanner(System.in);
|
||||
int a = sc.nextInt();
|
||||
int b = sc.nextInt();
|
||||
|
||||
int sum = a + b; // integer addition is discouraged in print statements due to confusion with string concatenation
|
||||
System.out.println("a + b = " + sum);
|
||||
System.out.println("a - b = " + (a - b));
|
||||
System.out.println("a * b = " + (a * b));
|
||||
System.out.println("quotient of a / b = " + (a / b)); // truncates towards 0
|
||||
System.out.println("remainder of a / b = " + (a % b)); // same sign as first operand
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue