Home Answers Viewqa Java-Beginners how to create this diamond structure with java.

 
 


astar
how to create this diamond structure with java.
1 Answer(s)      3 years and 4 months ago
Posted in : Java Beginners

*
***
***** *
*** ***
* ***** *
*** ***
* ***** *
*** ***
* *****
***
*
View Answers

January 23, 2010 at 4:53 PM


Hi Friend,

Try the following code:

class Stars{
public static void main(String []args){
for(int i=1;i<=5;i+=2){
System.out.println("");
for(int j=1;j<=i;j++)
System.out.print("*");
}
System.out.print(" *");
System.out.println();
for(int k=1;k<=2;k++){
for(int l=1;l<=3;l++){
System.out.print("*");
}
System.out.print(" ");
}
System.out.println();
for(int i=1;i<=2;i++){
System.out.print("*");
System.out.print(" ");
for(int j=1;j<=5;j++){
System.out.print("*");
}
System.out.println(" *");

for(int k=1;k<=2;k++){
for(int l=1;l<=3;l++){
System.out.print("*");
}
System.out.print(" ");
}
System.out.println();
}
System.out.print("* ");
for(int i=5;i>=0;i-=2){
for(int j=0;j<i;j++){
System.out.print("*");
}
System.out.println();
}
}
}

Thanks









Related Pages:
how to create this diamond structure with java. - Java Beginners
how to create this diamond structure with java.   * *** ***** * *** *** * ***** * *** *** * ***** * *** *** * ***** *** *   
Diamond - Java Beginners
Break out of if statement java  Hi, please explain how to break out of if statement in Java?  Hi Friend,public class PrintExam{ public static void main(String[] args){ int i; int j; for(i=1; i<7; i++){ for(j=0
What is a Loose Diamond?
and create true works of art for the perfect diamond. Now, if you... have the cut. The cut is the way the jeweler has finished the diamond and how the loose diamond reflects light and how it allows it to pass through
structure in JSP
structure in JSP  How do I achieve structure in JAVA or JSp
Diamond shape num - Java Interview Questions
Diamond shape num  How To Print Diamond Shape Numbers I Want Logic?Using For loops?  Hi Friend, Try the following code: public class Diamond{ public static void main(String[] args){ int row = 5; for(int i=1
how to create this structure in json using grails
how to create this structure in json using grails  { "query": { "type": "cluster", "view": "accountActivity", "regions": [2342,334,241,13], "companies": [43228583,433421683,342427783], "departments": [1,2,4,6], "brands
How to make a diamond necklace, make a diamond necklace, diamond necklace
How to make a diamond necklace       This tutorial will give you instruction to make draw a diamond necklace, so follow all the steps to make similar. New file: First take a new
Draw a diamond - Java Beginners
Draw a diamond  I want to draw a diamond shapein java using (*) in 9 lines. Here is the code import java.util.*; public class Diamond { static... the problem : import java.util.*; public class Diamond { static Scanner
mysqldump structure only
mysqldump structure only  Hi, How to take dump of database structure only? Provide me the syntax to take mysqldump structure only. Thanks   Hi, You can use -d option with mysqldump command to take the structure only
why to create directory structure as web-inf & classes & lib - Java Beginners
why to create directory structure as web-inf & classes & lib    we all know that to prepare webapplications we will create a direcotry sturcture... actually what is the reason behind this creating this directory structure
why to create directory structure as web-inf & classes & lib - Java Beginners
why to create directory structure as web-inf & classes & lib    we all know that to prepare webapplications we will create a direcotry sturcture... actually what is the reason behind this creating this directory structure
DIAMOND PROGRAM - Java Interview Questions
DIAMOND PROGRAM  I Want Print Diamond ?I Want Code?plz help me  Hi Friend, Try the following code: public class PrintDiamond { public static void main(String[] args) { int n = 5; for (int i = -n
create
create  how to create an excel file using java
Diamond Jewelry
Diamond Jewelry Everyone loves diamonds, especially ladies, because besides... a lot more comfortable in special situations. Basically, diamond jewelry... the cheapest diamond jewelry items, you are making a statement. Don't get us
ARRAY DIAMOND - Java Interview Questions
ARRAY DIAMOND  HI I WANT PRINT LIKE THIS I Want Print In Diamond Shape? 1 2 3 4 5 6 5 4 3 2 1 4 3 2 1 3 2 1 2 1 1 I WANT SOURCE CODE?  Hi Friend, Try the following code: class
DIAMOND PROGRAM 122 - Java Interview Questions
DIAMOND PROGRAM 122  I Want Print Exact Diamond Shape?I Want Code ?Plz Help Me?  Hi Friend, Try the following code: public class Diamond{ public static void main(String[] args){ int row = 7; for(int i=1; i<
Array of structure
Array of structure  create employment details with necessary field using array of structure
Is there a data structure like a class that doesn't need to be defined as a class in it's own file?
another charge. However, I recall once seeing a data structure that one could create...Is there a data structure like a class that doesn't need to be defined as a class in it's own file?  I am new to java, and I am trying to make
which data structure is good in java..? - Java Beginners
which data structure is good in java..?  Hi frends, Actually i want to store and retrieve some data using data structures like array list, stack... anyone give me good example how that best technique i can use in my programs
Data structure
Data structure: How to sort numbers in a queue using a bubble sort method?  How to sort numbers in a queue using a bubble sort method
C Structure
C Structure  Respected sir, Can a structure in C contain a pointer to itself ? if yes means how sir ? plz help me sir
inbox structure
inbox structure  I want to create an inbox for my project in which records are to be fetched dynamically. I am using netbeans (jsp + javascript+ servlet.) The structure is same like yahoo inbox (1st column full of check boxes
How to create a class in java
How to create a class in java  I am a beginner in programming and tried to learn how to do programming in Java. Friends please explain how can I create a class in Java
How to Create Keyboard in JAVA
How to Create Keyboard in JAVA  please help me to create On-Screen Keyboard with java and please give me an another idia to make it ..............iam waiting for your help ,think u so much
INBOX STRUCTURE
INBOX STRUCTURE  Please someone help me by telling how an inbox will be created to display dynamic records. Using oracle, jsp, servlets, javascript. If you can send me format for this,hat will be a great help for me
how to create interfaces in java
how to create interfaces in java  HI, Here is my code public interface validateInfo { public void validate(String empcode, String password); } class updateInfo implements validateInfo { public void update() { //code
how to create reports in swing java?
how to create reports in swing java?  how to create reports in swing java
I need to output number diamond using nested for loops.
I need to output number diamond using nested for loops.  How to i output this using nested for loops 1 131 13531 1357531 135797531 1357531 13531 131 1
use tables to structure forms
use tables to structure forms  How can I use tables to structure forms
use tables to structure forms
use tables to structure forms  How can I use tables to structure forms
tables to structure forms
tables to structure forms  How can I use tables to structure forms
tables to structure forms
tables to structure forms  How can I use tables to structure forms
How to create form in Swings
How to create form in Swings  How to create registration, login and question form in Java Swing?   Creating different forms in Java Swing - Examples how to create registration form in swing swing login form example
How to create first program in Java?
How to create first program in Java?  Hi, I am new in Java programming. Tell me How to create first program in Java? Thanks   Hi, Read more at First Java Program. Thanks
how to create a table
how to create a table  create table tablename (name varchar(10),name.... Use the following query: create table tablename (name varchar(10),address varchar(10)); For more information, visit the following link: Java Create
What is the structure of Spring framework?
What is the structure of Spring framework?  What is the structure of Spring framework?   Hi, In Java Spring framework offers one-stome... by you as per you application requirement. For more related to Java Spring
In data structure in java how to parse the given string and counts the member of character that match the given data?
In data structure in java how to parse the given string and counts the member of character that match the given data?  Design a parser that parse the given string and counts the member of character that match the given data.using
cylinder tree structure
code to create the tree structure. your advice will be very very appreciated... materials in a hierarchical structure in a cylinder form. for example my interface
how to create executable - Java Beginners
how to create executable  How do i create a executable file from a java file thnks in adv...!  Hi Friend, Try the following code: import java.io.*; import java.util.jar.*; public class CreateExe { public
how create package of this java code
how create package of this java code  Hi,i have email code in java which is working fine with out making package but when i want to make package of this code its stop working.Its showing exception while I execute it.I have to use
how create package of this java code
how create package of this java code  Hi,i have email code in java which is working fine with out making package but when i want to make package of this code its stop working.Its showing exception while I execute it.I have to use
How to create a jar file
How to create a jar file  Hello!!!! I have a project which has... a single executable jar of it... so pls tell me how it will b possible for me???   The given code creates a jar file using java. import java.io.*; import
how to create using jsp
how to create using jsp  code 1: <%@ page language="java...; <title>Create New Student</title> </head> <body> <form name="create" method="post" action="<
java programming structure - Java Beginners
java programming structure  java programming structure  Hi Friend, The structure of Java programme is: [Package declarations] [Import statements] [Class declaration] [Method declaration] eg: package
How to Display Data in a tree structure on the GUI
How to Display Data in a tree structure on the GUI  how to display data in a tree structure on the GUI? I need this sort of UI to display data showing a set of rules showing various conditions and the actions related
how to create an excel file using java
how to create an excel file using java  how to create an excel file using java
how to create exce sheet using java
how to create exce sheet using java  how to create excel sheet using java
how to create a header in jtable using java swing
how to create a header in jtable using java swing  how to create a header in jtable using java swing   d
diamond print
diamond print   print the pattern 1 2 3 4 5 6 7 8 9 10 11 12

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.