-
Notifications
You must be signed in to change notification settings - Fork 0
/
FallInt1.java
32 lines (27 loc) · 859 Bytes
/
FallInt1.java
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
26
27
28
29
30
31
32
class FallInt1 {
public static void main(String args[]) {
int x, y, x_speed, y_speed;
int g;
int r,c;
g = -10;
r = 10000;
c = 0;
x = 0;
y = 100000;
x_speed = 800;
y_speed = 0;
while( y >= 0 ) {
y_speed = y_speed + g/r;
x = x + x_speed/r;
y = y + y_speed/r;
c++;
if( c == r ) {
System.out.print("" + x + "," + (100000-y) + ",\n");
c = 0;
}
}
System.out.print("" + x + "," + (100000-y) + "");
System.out.print("estimated distance = " + x + "\n");
return;
}
}