#Can someone help me with this exercise please?
20 messages · Page 1 of 1 (latest)
Hey, @zinc fog!
Please remember to /close this post once your question has been answered!
what do you have so far
import java.util.Scanner;
public class Ex1 {
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int rows = scan.nextInt();
for(int i = rows; i >= 1; --i) {
for (int j = 1; j <= i; ++j) {
System.out.print("* ");
}
System.out.println();
}
}
}
The dots under the * are *
import java.util.Scanner;
public class Playground {
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int rows = scan.nextInt();
int rowNumber=0;
for(int i = 0; i<rows; i++) {
for (int j=0;j<=rowNumber;j++){
System.out.print("* ");
}
rowNumber++;
System.out.println();
}
}
}
this is what i got if you dont need to alternate between characters, if you do might be a little harder
the phrasing inside your parameters of your for loops made me die inside a bit
I already did the one above at another homework
I need it alternate
That is why I asked for help
So can you help me with this , please?
Did you figure it out?
The modulo operator is one of the less-widely understood operators by many computer programmers. It has some very useful algorithmic use cases, however. In this video, we create a Christmas tree using a modulo-based repeating pattern.
this is so clean! prefer this, since it is super easy to edit the pattern
Thank you both!