import java.io.BufferedReader; import java.io.InputStreamReader; //horrible recursive for loops are not fun //they aren't a good way to teach something //why can't we do fizzbuzz? //or make small games? //or do data manipulation? //or solve a problem? //or something more enjoyable than this? //maybe CS really should stay a hobbiest, self taught skill //at least when its a hobby you learn what matters at your own pace //here its just being given an unrealistic task that, albiet difficult, is not rewarding //making a diamond like this doesn't teach me good programming //it teaches me for loops //and nested for loops are usually not a good way to go about things //I just want to make command line tools and data parsers for gods sake! //maybe mom was right, I should just go for law //sysadmining seems nice though, I could do that //yeah, law or sysadmin. That seems nice //or I could write and edit for a living, that doesn't seem too bad class Diamond { public static void main(String[] args) throws java.io.IOException { BufferedReader dmndsizeI = new BufferedReader(new InputStreamReader(System.in)); System.out.println("input size"); int dmndsize = Integer.parseInt(dmndsizeI.readLine()); for (int i = 1; i < dmndsize; i += 2) { for (int j = 0; j < dmndsize -1 - i / 2; j++) System.out.print(" "); for (int j = 0; j < i; j++) System.out.print("*"); System.out.print("\n"); } for (int i = 7; i > 0; i -= 2) { for (int j = 0; j < 9 - i / 2; j++) System.out.print(" "); for (int j = 0; j < i; j++) System.out.print("*"); System.out.print("\n"); }}} //By msglm; Licensed under the AGPL v3