Hello Im a java Beginner and
I need a program that the output is like this:

*
**
***
**
*
and a Diamond

Can s0meone make me a program of this.. Just a simple code. Thank you so much!!

Recommended Answers

All 5 Replies

We can help, but we won't do it all for you. You need to also put your pattern in code tags so the spacing isn't stripped out. Otherwise, we can't tell what the pattern is supposed to be:

[code]
paste pattern here
[/code]

public class diamond {
	
	public static void main(String [] args ){
		
		System.out.println("*");
		System.out.println("**");
		System.out.println("***");
		System.out.println("**");
		System.out.println("*");
		
		System.out.println("  *");
		System.out.println(" ***");
		System.out.println("*****");
		System.out.println(" ***");
		System.out.println("  *");
	}
}

The purpose was more than likely to do it with some sort of loop. Regardless, don't post full code solutions to entire programs.

how you will code it using loop? can you give me an example?

yes sir.. using for loop... Thnx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.