-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMaths.java
More file actions
25 lines (23 loc) · 948 Bytes
/
Maths.java
File metadata and controls
25 lines (23 loc) · 948 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
short num1 = 50, num2 = 10;
int res1 = num1 + num2;
int res2 = num1 - num2;
int res3 = num1 * num2;
int res4 = num1 / num2;
System.out.println("Resault of + : " + res1);
System.out.println("Resault of - : " + res2);
System.out.println("Resault of * : " + res3);
System.out.println("Resault of / : " + res4);
float num3 = 40, num4 = 27; //answer with float
float res5 = num3 / num4; // 1.4814814
int num5 = 40, num6 = 27; // answer without float
int res6 = num5 / num6; // 1
float res7 = num3 % num4; //shows remainders (with .0 bcs it's float)
System.out.println("Resault: " + res5);
System.out.println("Resault: " + res6);
System.out.println("Resault: " + res7);
}
}