Skip to content

Instantly share code, notes, and snippets.

@chestergrant
Created July 1, 2012 08:04
Show Gist options
  • Save chestergrant/3027478 to your computer and use it in GitHub Desktop.
Save chestergrant/3027478 to your computer and use it in GitHub Desktop.
Print my first name 100 times, and every count of 20 print my last name. Part of "1000 programming exercises by Chess"
public class InterweavingNames {
public static void main(String[] args) {
String firstname = "Chester";
String lastname = "Grant";
for(int i =1; i<=100; i++){
System.out.print(firstname);
if((i % 20) == 0){
System.out.print(" "+lastname);
}
System.out.println();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment