Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Homework 9/9
- *
- * Jackson Carroll
- */
- public class HW9_9
- {
- public static void main(String[]args)
- {
- }
- public static void twentyTwo()
- {
- int total = 25;
- for (int number = 1; number <= (total/2); number++)
- {
- total = total - number;
- System.out.println(total + " " + number);
- }
- }
- public static void twentyFour()
- {
- for (int i = 1; i <= 3; i++)
- {
- System.out.println("How many lines");
- System.out.println("are printed?");
- }
- }
- public static void twentySix()
- {
- for(int i = 1; i <= 5; i++)
- {
- for (int j = 1; j <= 10; j++)
- {
- System.out.print((i * j) + " ");
- }
- System.out.println();
- }
- }
- public static void twentyEight()
- {
- for (int i = 1; i <= 2; i++)
- {
- for (int j = 1; j <= 3; j++)
- {
- for (int k = 1; k <= 4; k++)
- {
- System.out.print("*");
- }
- }
- System.out.print("!");
- System.out.println();
- }
- }
- public static void six()
- {
- int lineNumber = 1;
- for (lineNumber = 1; lineNumber <=7; lineNumber++)
- {
- for (int i = 1; i <= lineNumber; i++)
- {
- System.out.print(lineNumber);
- }
- System.out.println();
- }
- }
- public static void fifteen()
- {
- int num = 1;
- for (int lineNum = 1; lineNum <= 5; lineNum++)
- {
- for (int dash = 1; dash <= 6 - lineNum; dash++)
- {
- System.out.print("-");
- }
- for (int value = 1; value <= num; value++)
- {
- System.out.print(num);
- }
- for (int dash = 1; dash <= 6 - lineNum; dash++)
- {
- System.out.print("-");
- }
- System.out.println();
- num = num + 2;
- }
- }
- public static void twenty()
- {
- int num = 32;
- int slashCount = 1;
- for (int lineNum = 1; lineNum <= 5; lineNum = lineNum++)
- {
- for (int slash = 1; slash <= 17 - slashCount; slash++)
- {
- System.out.print("/");
- }
- for (int value = 32; value >= num; value--)
- {
- System.out.print("*");
- //i get an infinite loop of *'s when i run this code
- //and i have no idea why.
- }
- for (int slash = 1; slash <= 17 - slashCount; slash++)
- {
- System.out.print("\\");
- }
- System.out.println();
- num = num - 8;
- slashCount = slashCount + 4;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement