Skip to content

Instantly share code, notes, and snippets.

@Animeshz
Created September 8, 2018 14:43
Show Gist options
  • Save Animeshz/84b0023b6f8c45044c75ba58f41ed964 to your computer and use it in GitHub Desktop.
Save Animeshz/84b0023b6f8c45044c75ba58f41ed964 to your computer and use it in GitHub Desktop.
TeluskoLearning Assignment of chapter 3.4
public class TeluskoLerning3_4Assignment
{
public void assignment1()
{
for(int i=1; i<=6; i++) {
for (int j=1; j<=i; j++) {
System.out.print(j + " ");
}
System.out.println();
}
}
public void assignment2()
{
for(int i=1; i<=3; i++) {
for (char j='A'; j-64<=i; j++) {
System.out.print(j + " ");
}
System.out.println();
}
}
public void assignment3()
{
int length = 6;
for (int i = 1; i <= length; i++) {
for (int j = 1; j <= length; j++) {
if (!((i==length || i==1) || (j==length || j==1))) {
System.out.print(" ");
continue;
}
System.out.print("$ ");
}
System.out.println();
}
}
public static void main(String[] args)
{
TeluskoLerning3_4Assignment t = new TeluskoLerning3_4Assignment();
t.assignment1();
System.out.println();
t.assignment2();
System.out.println();
t.assignment3();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment