package chap01;
public class Math {
public static void main (String [] args) {
int a,b,c,d,e,f;
double g;
a = 1000;
b = 2000;
c = a+b;
d = a-b;
e = a*b;
f = a/b;
g = a%b;
System.out.println ("Add = " + c);
System.out.println ("Patch = " + d);
System.out.println ("multiplication = " + e);
System.out.println ("divide = "+f);
System.out.println ("remaining = "+g);
}
}
Add = 3000 Subtraction = -1000 Multiplication = 2000000 Divide = 0 Remaining = 1000
The result is like this Can anyone tell me what's wrong with the rest?
java
The remainder of 1000% 2000 is 1000. The value of 0.5 you want is float a = 1000, b = 2000; System.out.println(a/b); You can get it from that.
© 2024 OneMinuteCode. All rights reserved.