Created
October 2, 2017 17:30
-
-
Save PocasPedro/a274ef8ce1962fc834619b59863e54df to your computer and use it in GitHub Desktop.
Java Fundaments for Kids - Exercise 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Program description | |
*/ | |
public class Sequence { | |
public static void main(String[] args) { | |
int beginning = 1; | |
int sequence; | |
Print(beginning); | |
sequence = Sum(beginning); | |
Print(sequence); | |
sequence = Sum(sequence); | |
Print(sequence); | |
sequence = Sum(sequence); | |
Print(sequence); | |
sequence = Sum(sequence); | |
Print(sequence); | |
sequence = Sum(sequence); | |
Print(sequence); | |
sequence = Sum(sequence); | |
Print(sequence); | |
sequence = Sum(sequence); | |
Print(sequence); | |
sequence = Sum(sequence); | |
Print(sequence); | |
sequence = Sum(sequence); | |
Print(sequence); | |
} | |
public static int Sum (int previousnumber){ | |
int actualnumber = previousnumber +1; | |
return actualnumber; | |
} | |
public static void Print (int numbertoprint){ | |
System.out.println(numbertoprint); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment