-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestcode.txt
More file actions
59 lines (51 loc) · 905 Bytes
/
Testcode.txt
File metadata and controls
59 lines (51 loc) · 905 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
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
# Using this file to log test inputs since the text refreshes when the page re-renders
---Integer assignment---
int a = 59
int b = 40
int c = a + b
System.out.print(c)
---Expression assignment to variable---
int num = 0
num = num + 3
System.out.print(num)
---If-else statement---
int num = 3
if (num > 3) {
System.out.print("less")
}
else {
System.out.print("more")
}
---If-else-if-else statement---
int num = 3
if (num > 3) {
System.out.print("less")
}
else if (num > 2) {
System.out.print(num)
}
else {
System.out.print("more")
}
---For loop with if statements---
int num = 5
for (int i = 0; i < num; i++) {
if (i > 2) {
System.out.print(+2)
}
if (i < 2) {
System.out.print(-2)
}
}
---For loop with if-else---
int num = 10 + 3
for (int i = 0; i < 10; i++) {
if (i < 5) {
System.out.print(i)
}
else {
System.out.print(100)
}
}
System.out.print(i + num)
System.out.print(num)