Shape

Shape

Respected Sir, Please send me the code of diamond shape by using loop and with single statement of " " and single statement with "*".  ... for diamond shape.

View Answers

April 9, 2008 at 6:02 PM

Hi friend

I understand your problem, so that I am sending you coding for diamond shape.
Please let me know for further help.
Hope it will help u.

import java.io.*;
import java.io.BufferedReader;

public class PrintDiamond{
public static final void main(String[] args) throws IOException{
BufferedReader read = new BufferedReader( new InputStreamReader(System.in));
System.out.print("Enter the numerical Numebr:");
String str= read.readLine();
int n = Integer.parseInt(str);
for ( int i = 1; i <= n; i += 2 ){
for(int k = 0; k < ( n - i ); k += 2)
System.out.print(" ");
for(int j = 0; j < ( ( i * 2 ) - 1 ); j += 2)
System.out.print("*");
System.out.println("");
}
for(int i = 1; i <= n; i += 2){
for(int k = 1; k < i; k += 2)
System.out.print(" ");
for(int j = 0; j <= (n - i); j++)
System.out.print("*");
System.out.println( "" );
}
}
}









Related Tutorials/Questions & Answers:
shape looping
shape looping  can some1 help me?i have to make a shape using "*" by looping...and i dun know how...please and thank you * **   java diamond shape: public class Diamond{ public static void main(String[] args){ int
ModuleNotFoundError: No module named 'shape'
ModuleNotFoundError: No module named 'shape'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'shape' How to remove the ModuleNotFoundError: No module named 'shape'
Advertisements
How to convert a picture into a shape, convert a picture into a shape, picture shape
How to convert a picture into a shape       If you want to use a picture shape but you are not able for that, don't worry. You will learn easily to convert a picture into shape. Take
Shape - Java Beginners
Shape  Respected Sir, Please send me the code of diamond shape by using loop and with single statement of " " and single statement with "*".  ... for diamond shape.   Hi friend I understand your problem, so that I
ModuleNotFoundError: No module named 'dxl-shape'
ModuleNotFoundError: No module named 'dxl-shape'  Hi, My Python... 'dxl-shape' How to remove the ModuleNotFoundError: No module named 'dxl-shape' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'shape-commentator'
ModuleNotFoundError: No module named 'shape-commentator'  Hi, My... named 'shape-commentator' How to remove the ModuleNotFoundError: No module named 'shape-commentator' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'shape-types'
ModuleNotFoundError: No module named 'shape-types'  Hi, My Python... 'shape-types' How to remove the ModuleNotFoundError: No module named 'shape-types' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'dxl-shape'
ModuleNotFoundError: No module named 'dxl-shape'  Hi, My Python... 'dxl-shape' How to remove the ModuleNotFoundError: No module named 'dxl-shape' error? Thanks   Hi, In your python environment you
Version of ca.seinesoftware>xml-shape dependency
List of Version of ca.seinesoftware>xml-shape dependency
ModuleNotFoundError: No module named 'spats-shape-seq'
ModuleNotFoundError: No module named 'spats-shape-seq'  Hi, My... named 'spats-shape-seq' How to remove the ModuleNotFoundError: No module named 'spats-shape-seq' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'SWMM-xsections-shape-generator'
ModuleNotFoundError: No module named 'SWMM-xsections-shape-generator' ...: No module named 'SWMM-xsections-shape-generator' How to remove the ModuleNotFoundError: No module named 'SWMM-xsections-shape-generator' error
ModuleNotFoundError: No module named 'esy-osm-shape'
ModuleNotFoundError: No module named 'esy-osm-shape'  Hi, My... 'esy-osm-shape' How to remove the ModuleNotFoundError: No module named 'esy-osm-shape' error? Thanks   Hi, In your python
How to convert new paper into a man shape, convert new paper into a man shape, new paper into a man shape
How to convert new paper into a man shape   ... shape in this example. Take a new picture: Take a news paper picture, choose Polygonal lasso tool (L key) to make selection like a man shape
Version of com.shapesecurity>shape-functional-java dependency
List of Version of com.shapesecurity>shape-functional-java dependency
Maven Dependency xml-shape >> 1.0.0
You should include the dependency code given in this page to add Maven Dependency of ca.seinesoftware >> xml-shape version1.0.0 in your project
NameError: name 'input_shape' is not defined tensorflow 2.0
NameError: name 'input_shape' is not defined tensorflow 2.0  Hi, I...(Flatten(input_shape(28,28))) it is throwing the following error: NameError: name 'input_shape' is not defined tensorflow 2.0 How to resolve it? Thanks
NameError: name 'input_shape' is not defined tensorflow 2.0
NameError: name 'input_shape' is not defined tensorflow 2.0  Hi, I...(Flatten(input_shape(28,28))) it is throwing the following error: NameError: name 'input_shape' is not defined tensorflow 2.0 How to resolve it? Thanks
NameError: name 'input_shape' is not defined tensorflow 2.0
NameError: name 'input_shape' is not defined tensorflow 2.0  Hi, I...(Flatten(input_shape(28,28))) it is throwing the following error: NameError: name 'input_shape' is not defined tensorflow 2.0 How to resolve it? Thanks
Drawing a Shape in Excel Sheet
Drawing a Shape in Excel Sheet In this section, you will learn how to draw a shape in excel sheets using Apache POI library. Using Apache POI, you can draw a shape with the help of Microsoft Office drawing tools. The top-most shape
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
Maven Repository/Dependency: ca.seinesoftware | xml-shape
Maven Repository/Dependency of Group ID ca.seinesoftware and Artifact ID xml-shape. Latest version of ca.seinesoftware:xml-shape dependencies. # Version Release Date 1 1.0.0
triangle shape
coding shape
Maven Dependency shape-functional-java >> 1.0.1
You should include the dependency code given in this page to add Maven Dependency of com.shapesecurity >> shape-functional-java version1.0.1 in your project
Maven Dependency shape-functional-java >> 1.0.2
You should include the dependency code given in this page to add Maven Dependency of com.shapesecurity >> shape-functional-java version1.0.2 in your project
Maven Dependency shape-functional-java >> 1.0.3
You should include the dependency code given in this page to add Maven Dependency of com.shapesecurity >> shape-functional-java version1.0.3 in your project
Maven Dependency shape-functional-java >> 1.1.0
You should include the dependency code given in this page to add Maven Dependency of com.shapesecurity >> shape-functional-java version1.1.0 in your project
Maven Dependency shape-functional-java >> 2.0.0
You should include the dependency code given in this page to add Maven Dependency of com.shapesecurity >> shape-functional-java version2.0.0 in your project
Maven Dependency shape-functional-java >> 2.0.1
You should include the dependency code given in this page to add Maven Dependency of com.shapesecurity >> shape-functional-java version2.0.1 in your project
Maven Dependency shape-functional-java >> 2.0.2
You should include the dependency code given in this page to add Maven Dependency of com.shapesecurity >> shape-functional-java version2.0.2 in your project
Maven Dependency shape-functional-java >> 2.1.0
You should include the dependency code given in this page to add Maven Dependency of com.shapesecurity >> shape-functional-java version2.1.0 in your project
Maven Dependency shape-functional-java >> 2.3.1
You should include the dependency code given in this page to add Maven Dependency of com.shapesecurity >> shape-functional-java version2.3.1 in your project
Create Shape in Excel Using JSP
create shape in excel using jsp    ...; and then after we create a shape. At excel sheet e.g. we are creating line in this example. To create shape we use setShapeType() in this method we are passing
Creating Auto Shape in PowerPoint Using Java
Creating Auto Shape in PowerPoint Using Java... to create auto shape on PowerPoint slide using java. In this example, we are creating the object of AutoShape .We are passing the shape type into AutoShape
Inserting Text on Shape Using Java
Inserting Text on Shape Using Java       In this example we are going to create auto shape... the object of AutoShape .We are passing the shape type into AutoShape as argument
Maven Repository/Dependency: com.shapesecurity | shape-functional-java
Maven Repository/Dependency of Group ID com.shapesecurity and Artifact ID shape-functional-java. Latest version of com.shapesecurity:shape-functional-java dependencies. # Version Release Date
Maven dependency for ca.seinesoftware - xml-shape version 1.0.0 is released. Learn to use xml-shape version 1.0.0 in Maven based Java projects
Maven dependency for  ca.seinesoftware  - Version 1.0.0 of xml-shape released The developers of   ca.seinesoftware - xml-shape project... version of  ca.seinesoftware - xml-shape library is 1.0.0. Developer can use
print numbers in traingle shape
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for xml-shape version 1.0.0
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for xml-shape...:xml-shape:1.0.0 Java library in your project.. Maven, Gradle, SBT, Ivy, Grape, Leiningen and  Buildr Dependency for xml-shape version 1.0.0
Maven dependency for com.shapesecurity - shape-functional-java version 2.6.3 is released. Learn to use shape-functional-java version 2.6.3 in Maven based Java projects
Maven dependency for  com.shapesecurity  - Version 2.6.3 of shape-functional-java released The developers of   com.shapesecurity - shape... May 2021, the released version of  com.shapesecurity - shape-functional
Maven dependency for com.shapesecurity - shape-functional-java version 2.8.0 is released. Learn to use shape-functional-java version 2.8.0 in Maven based Java projects
Maven dependency for  com.shapesecurity  - Version 2.8.0 of shape-functional-java released The developers of   com.shapesecurity - shape... Apr 2022, the released version of  com.shapesecurity - shape-functional
Maven dependency for com.shapesecurity - shape-functional-java version 3.0.0 is released. Learn to use shape-functional-java version 3.0.0 in Maven based Java projects
Maven dependency for  com.shapesecurity  - Version 3.0.0 of shape-functional-java released The developers of   com.shapesecurity - shape... May 2022, the released version of  com.shapesecurity - shape-functional
Maven dependency for com.shapesecurity - shape-functional-java version 3.1.0 is released. Learn to use shape-functional-java version 3.1.0 in Maven based Java projects
Maven dependency for  com.shapesecurity  - Version 3.1.0 of shape-functional-java released The developers of   com.shapesecurity - shape... May 2022, the released version of  com.shapesecurity - shape-functional
Maven dependency for com.shapesecurity - shape-functional-java version 2.7.0 is released. Learn to use shape-functional-java version 2.7.0 in Maven based Java projects
Maven dependency for  com.shapesecurity  - Version 2.7.0 of shape-functional-java released The developers of   com.shapesecurity - shape... Apr 2022, the released version of  com.shapesecurity - shape-functional
Maven dependency for com.shapesecurity - shape-functional-java version 1.0.1 is released. Learn to use shape-functional-java version 1.0.1 in Maven based Java projects
Maven dependency for  com.shapesecurity  - Version 1.0.1 of shape-functional-java released The developers of   com.shapesecurity - shape... Aug 2015, the released version of  com.shapesecurity - shape-functional
Maven dependency for com.shapesecurity - shape-functional-java version 2.6.2 is released. Learn to use shape-functional-java version 2.6.2 in Maven based Java projects
Maven dependency for  com.shapesecurity  - Version 2.6.2 of shape... - shape-functional-java project have released the latest version of this library on 27 Sep 2019, the released version of  com.shapesecurity - shape
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for shape-functional-java version 2.5.1
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for shape... com.shapesecurity:shape-functional-java:2.5.1 Java library in your project.. Maven, Gradle, SBT, Ivy, Grape, Leiningen and  Buildr Dependency for shape
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for shape-functional-java version 2.5.0
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for shape... com.shapesecurity:shape-functional-java:2.5.0 Java library in your project.. Maven, Gradle, SBT, Ivy, Grape, Leiningen and  Buildr Dependency for shape
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for shape-functional-java version 2.4.1
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for shape... com.shapesecurity:shape-functional-java:2.4.1 Java library in your project.. Maven, Gradle, SBT, Ivy, Grape, Leiningen and  Buildr Dependency for shape
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for shape-functional-java version 2.4.0
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for shape... com.shapesecurity:shape-functional-java:2.4.0 Java library in your project.. Maven, Gradle, SBT, Ivy, Grape, Leiningen and  Buildr Dependency for shape

Ads