Last active
August 29, 2015 14:18
-
-
Save cloneko/6b80fbf56ae2fa828d6f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class kochan{ | |
public static void main(String args[]){ | |
reverseTriangle(10); | |
System.out.println("--"); | |
square(10); | |
System.out.println("--"); | |
triangle(10); | |
} | |
public static String line(String character,int count){ | |
String str = ""; | |
for(int i = 0;i < count;i++){ | |
str = str + character; | |
} | |
return str; | |
} | |
public static void square(int lines){ | |
for(int i = 0;i < lines;i++){ | |
System.out.println(line("*",lines)); | |
} | |
} | |
public static void reverseTriangle(int lines){ | |
while(lines > 0){ | |
System.out.println(line(".",lines--)); | |
} | |
} | |
public static void triangle(int lines){ | |
int current = 1; | |
while(true){ | |
System.out.println(line(".",current++)); | |
if(current > lines){ | |
break; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment