-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMagic.java
41 lines (34 loc) · 1.27 KB
/
Magic.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
public class Magic {
public static void main(String[] args) {
/* Create an int variable called myNumber.
Set it equal to any integer other than 0. */
int myNumber = 5; // Original number
/* Create an int variable called stepOne.
Set it equal to the original number
(myNumber) multiplied by itself. */
int stepOne = myNumber * myNumber;
/* Create an int variable called stepTwo.
Set it equal to the previous result
(stepOne) plus the original number
(myNumber).*/
int stepTwo = stepOne + myNumber;
/* Create an int variable called stepThree.
Set it equal to the previous result (stepTwo)
divided by the original number. */
int stepThree = stepTwo / myNumber;
/* Create an int variable called stepFour.
Set it equal to the previous result (stepThree)
plus 17. */
int stepFour = stepThree + 17;
/* Create an int variable called stepFive.
Set it equal to the previous result (stepFour)
minus the original number. */
int stepFive = stepFour - myNumber;
/* Create an int variable called stepSix.
Set it equal to the previous result (stepFive)
divided by 6. */
int stepSix = stepFive / 6;
// Print step 6
System.out.println(stepSix);
}
}