My assignment in my Java course is to make 3 triangles. One left aligned, one right aligned, and one centered. I have to make a menu for what type of triangle and then input how many rows is wanted...
If you look above to Brian's code, you can see he has a main loop, which controls how many lines of output are printed in this case there are 5. Where it says "// Determine number of spaces needed" You would use a nested loop to print 5 - i spaces, then your second nested loop to print j i amount of times. If you are having trouble with loops in general I would advise you to look in your book ...
I like to print a pattern in java which gives the output: 1 23 456 78910 .... But i am not getting how to do this, I wrote a program to print pattern of 1 12 123 1234 ... as import java.util.*;
I'm trying to print a pyramid of stars using nested while loops. I know I am able to achieve this using for loops but I want to do it with while loop instead. This is my code so far: public class
So I was assigned to make a diamond with asterisks in Java and I'm really stumped. Here's what I've come up with so far: public class Lab1 { public static void main (String [] args) { for...
0 Print pattern using single loop: the code is written in objective-c any one can use this logic and write program in their respective language. int k = 5;