-
Notifications
You must be signed in to change notification settings - Fork 0
/
BottlesOnTheWall.java
110 lines (100 loc) · 2.63 KB
/
BottlesOnTheWall.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
//Name: Prabhav P.
//Period: 1A
import java.util.*;
public class BottlesOnTheWall
{
public static void main(String[] args)
{
Scanner console = new Scanner(System.in);
//challenge 2
int a = 1;
while (a < 10)
{
System.out.print(a);
a ++ ;
}
System.out.println(" ");
System.out.println(" ");
//challenge 3
int b = 1;
while (b < 10)
{
System.out.print(b + " ");
b ++ ;
}
System.out.println(" ");
System.out.println(" ");
//challenge 4
int c = 1;
while (c < 20)
{
System.out.print(c + " ");
c += 2;
}
System.out.println(" ");
System.out.println(" ");
//challenge 5
int d = 5;
while (d < 55)
{
System.out.print(d + " ");
d += 5;
}
System.out.println(" ");
System.out.println(" ");
//challenge 6
int e = 10;
while (e > 0)
{
System.out.print(e + " ");
e -- ;
}
System.out.println(" ");
System.out.println(" ");
//challenge 8
int f = -4;
while (f != -44)
{
System.out.print(f + " ");
f -= 4;
}
System.out.println(" ");
System.out.println(" ");
//challenge 9
int g = 1;
while (g != 512)
{
System.out.print(g + " ");
g *= 2;
}
System.out.println(" ");
System.out.println(" ");
//challenge 10
double h = 1000;
while (h != 1)
{
System.out.print(h + " ");
h /= 2;
double modulus = h % 1;
h = h - modulus;
}
System.out.println(" ");
System.out.println(" ");
//challenge 11 - whenever you come back please help me
int i = 1;
while (i != 9)
{
System.out.print(i + " ");
int increment = 2;
if (i > 0)
{
i -= increment;
}
else if (i < 0)
{
i += increment;
}
increment ++ ;
}
}
}