...
This commit is contained in:
parent
051504d65b
commit
0457928c3e
295 changed files with 3588 additions and 3 deletions
15
Task/Arithmetic-Integer/Java/arithmetic-integer.java
Normal file
15
Task/Arithmetic-Integer/Java/arithmetic-integer.java
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
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
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue