Created
October 23, 2017 14:15
-
-
Save PocasPedro/2e55fb322437893a8a34cbcb5a94c091 to your computer and use it in GitHub Desktop.
Java Fundamentals for Kids - Exercise 12
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 that prints numbers 1-10 with Letters | |
*/ | |
public class WriteNumbers { | |
public static void main(String[] args) { | |
for(int i = 1 ; i <= 10 ; i++){ | |
Print(i); | |
} | |
} | |
public static void Print (int numbertoprint){ | |
if(numbertoprint < 0){ | |
System.out.println("Error"); | |
}else if(numbertoprint == 1){ | |
System.out.println("One"); | |
}else if(numbertoprint == 2){ | |
System.out.println("Two"); | |
}else if(numbertoprint == 3){ | |
System.out.println("Three"); | |
}else if(numbertoprint == 4){ | |
System.out.println("Four"); | |
}else if(numbertoprint == 5){ | |
System.out.println("Five"); | |
}else if(numbertoprint == 6){ | |
System.out.println("Six"); | |
}else if(numbertoprint == 7){ | |
System.out.println("Seven"); | |
}else if(numbertoprint == 8){ | |
System.out.println("Eight"); | |
}else if(numbertoprint == 9){ | |
System.out.println("Nine"); | |
}else if(numbertoprint == 10){ | |
System.out.println("Ten"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment