你的意思是说你不知道"for loop"是什么呢,还是不知道循环体内该写什么?
I only know how to write the program with "for loop" to display the letter "I". so I know how to use the "for loop" for very very simply programs. Here is the program for the letter ''I".
public class ASCIIArt {
public static void main(String[] args) {
Scanner userInput = new Scanner(System.in);
System.out.print("Please enter a number to indicate how many stars: \n");
final int MAX_SIZE = 8;
int size = userInput.nextInt();
for (int i = 1; i <= size; i++) {
if (size <=MAX_SIZE){
System.out.println(" *");
}
else{
System.out.println("Invalid entry.");
}
}
How do you use the "for loop" to write the program to display the letter "Z". the height of the letter "Z" changes accordingly when the user enters different numbers.