... using for loops in Java. For example, hello would be printed five times.
Here is my code so far:
import java.util.Scanner; class Words { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Please enter one word of your choice"); String word = scan.nextLine(); System.out.println(word); int length = word.length(); System.out.println(length); for (length < word; length++) { System.out.println(word); } } } We have to use the scanner package. Sorry if this is really basic but I'm just starting out and can't find an answer anywhere!
for (int n = word.length(); n >= 0; --n) { System.out.println(word); }