Code
This is the exact code as in the last one. I already did it with a single if statement and a single for loop.
/// Name: Koosha Kimelman
/// Period: 7
/// Program Name: Refresher Challenge
/// File Name: RefresherChallenge.java
/// Date Completed: 4/13/16
import java.util.Scanner;
public class RefresherChallenge {
public static void main(String[] args) {
Scanner k = new Scanner(System.in);
System.out.print("What is your name: ");
String name = k.next();
System.out.println();
for (int n = 1; n <= 10; n++) {
System.out.println(name);
if (name.equals("Josh"))
n++;
}
}
}
Picture of the output