#Can someone help me with this exercise please?

20 messages · Page 1 of 1 (latest)

zinc fog
#

Given a number n read from keyboard, generate n lines of the following structure:
Example n = 7;

  • @

  • @ *

  • @ *

  • @ * # @

  • @ * # @ *

sage aspenBOT
#

Hey, @zinc fog!
Please remember to /close this post once your question has been answered!

cosmic trellis
#

what do you have so far

zinc fog
#

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 *

cosmic trellis
#

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

zinc fog
#

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?

zinc fog
#

Did you figure it out?

cosmic trellis
#

let me know if any of the logic doesnt make sense

#

@zinc fog

spice oar
cosmic trellis
zinc fog
#

Thank you both!