Diamond shape num

Diamond shape num

How To Print Diamond Shape Numbers I Want Logic?Using For loops?
View Answers

December 26, 2009 at 5:29 PM

Hi Friend,

Try the following code:

public class Diamond{
public static void main(String[] args){
int row = 5;
for(int i=1; i<(row/2+.5); i++ ){
for (int j=1; j<(row/2+1.5)-i; j++){
System.out.print(" ");
}
for(int c=0; c<(i*2)-1; c++)
System.out.print(c);
System.out.println();
}
for(int d=1; d<row+1; d++){
System.out.print(d);
}
System.out.println();
for(int i=1; i<(row/2+.5); i++ ){
for(int c=0;c<i; c++)
System.out.print(" ");
for(int j=1; j<row-(i*2)+1; j++){
System.out.print(j);
}
System.out.println();
}
}
}

Hope that it will be helpful for you.
Thanks









Related Tutorials/Questions & Answers:
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
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
Advertisements
diamond print
diamond print   print the pattern 1 2 3 4 5 6 7 8 9 10 11 12
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... file with black background file as here.ADS_TO_REPLACE_1 Draw a shape: Choose
What is a Loose Diamond?
the shape of a loose diamond. There are hundreds of shapes, but the most common one is the one known as the diamond shape. This is also the cheapest...What is a Loose Diamond? Everyone knows what diamonds. Looking at them from
ModuleNotFoundError: No module named 'diamond'
ModuleNotFoundError: No module named 'diamond'  Hi, My Python... 'diamond' How to remove the ModuleNotFoundError: No module named 'diamond... to install padas library. You can install diamond python with following command
ModuleNotFoundError: No module named 'diamond'
ModuleNotFoundError: No module named 'diamond'  Hi, My Python... 'diamond' How to remove the ModuleNotFoundError: No module named 'diamond... to install padas library. You can install diamond python with following command
ModuleNotFoundError: No module named 'diamond'
ModuleNotFoundError: No module named 'diamond'  Hi, My Python... 'diamond' How to remove the ModuleNotFoundError: No module named 'diamond... to install padas library. You can install diamond python with following command
Shape - Java Beginners
Shape  Respected Sir, Please send me the code of diamond shape...... for diamond shape.   Hi friend I understand your problem, so that I am sending you coding for diamond shape.Please let me know for further help.Hope
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 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
ModuleNotFoundError: No module named 'appenlight-diamond'
ModuleNotFoundError: No module named 'appenlight-diamond'  Hi, My... named 'appenlight-diamond' How to remove the ModuleNotFoundError: No module named 'appenlight-diamond' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'diamond-accounting'
ModuleNotFoundError: No module named 'diamond-accounting'  Hi, My... named 'diamond-accounting' How to remove the ModuleNotFoundError: No module named 'diamond-accounting' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'diamond-next'
ModuleNotFoundError: No module named 'diamond-next'  Hi, My Python... 'diamond-next' How to remove the ModuleNotFoundError: No module named 'diamond-next' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'diamond-next'
ModuleNotFoundError: No module named 'diamond-next'  Hi, My Python... 'diamond-next' How to remove the ModuleNotFoundError: No module named 'diamond-next' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'diamond-patterns'
ModuleNotFoundError: No module named 'diamond-patterns'  Hi, My... named 'diamond-patterns' How to remove the ModuleNotFoundError: No module named 'diamond-patterns' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'diamond-patterns'
ModuleNotFoundError: No module named 'diamond-patterns'  Hi, My... named 'diamond-patterns' How to remove the ModuleNotFoundError: No module named 'diamond-patterns' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'Flask-Diamond'
ModuleNotFoundError: No module named 'Flask-Diamond'  Hi, My... 'Flask-Diamond' How to remove the ModuleNotFoundError: No module named 'Flask-Diamond' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'Puppet-Diamond'
ModuleNotFoundError: No module named 'Puppet-Diamond'  Hi, My... named 'Puppet-Diamond' How to remove the ModuleNotFoundError: No module named 'Puppet-Diamond' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'Puppet-Diamond'
ModuleNotFoundError: No module named 'Puppet-Diamond'  Hi, My... named 'Puppet-Diamond' How to remove the ModuleNotFoundError: No module named 'Puppet-Diamond' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'Puppet-Diamond'
ModuleNotFoundError: No module named 'Puppet-Diamond'  Hi, My... named 'Puppet-Diamond' How to remove the ModuleNotFoundError: No module named 'Puppet-Diamond' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'Puppet-Diamond'
ModuleNotFoundError: No module named 'Puppet-Diamond'  Hi, My... named 'Puppet-Diamond' How to remove the ModuleNotFoundError: No module named 'Puppet-Diamond' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'pytest-diamond'
ModuleNotFoundError: No module named 'pytest-diamond'  Hi, My... named 'pytest-diamond' How to remove the ModuleNotFoundError: No module named 'pytest-diamond' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'sf-diamond'
ModuleNotFoundError: No module named 'sf-diamond'  Hi, My Python... 'sf-diamond' How to remove the ModuleNotFoundError: No module named 'sf-diamond' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'spud-diamond'
ModuleNotFoundError: No module named 'spud-diamond'  Hi, My Python... 'spud-diamond' How to remove the ModuleNotFoundError: No module named 'spud-diamond' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'whale-diamond'
ModuleNotFoundError: No module named 'whale-diamond'  Hi, My... 'whale-diamond' How to remove the ModuleNotFoundError: No module named 'whale-diamond' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'whale-diamond'
ModuleNotFoundError: No module named 'whale-diamond'  Hi, My... 'whale-diamond' How to remove the ModuleNotFoundError: No module named 'whale-diamond' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'Agile-Diamond'
ModuleNotFoundError: No module named 'Agile-Diamond'  Hi, My... 'Agile-Diamond' How to remove the ModuleNotFoundError: No module named 'Agile-Diamond' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'appenlight-diamond'
ModuleNotFoundError: No module named 'appenlight-diamond'  Hi, My... named 'appenlight-diamond' How to remove the ModuleNotFoundError: No module named 'appenlight-diamond' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'diamond-accounting'
ModuleNotFoundError: No module named 'diamond-accounting'  Hi, My... named 'diamond-accounting' How to remove the ModuleNotFoundError: No module named 'diamond-accounting' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'diamond-next'
ModuleNotFoundError: No module named 'diamond-next'  Hi, My Python... 'diamond-next' How to remove the ModuleNotFoundError: No module named 'diamond-next' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'diamond-patterns'
ModuleNotFoundError: No module named 'diamond-patterns'  Hi, My... named 'diamond-patterns' How to remove the ModuleNotFoundError: No module named 'diamond-patterns' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'Flask-Diamond'
ModuleNotFoundError: No module named 'Flask-Diamond'  Hi, My... 'Flask-Diamond' How to remove the ModuleNotFoundError: No module named 'Flask-Diamond' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'num_calculus'
ModuleNotFoundError: No module named 'num_calculus'  Hi, My Python... 'num_calculus' How to remove the ModuleNotFoundError: No module named 'num_calculus' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'num-fh'
ModuleNotFoundError: No module named 'num-fh'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'num-fh' How to remove the ModuleNotFoundError: No module named 'num-fh'
ModuleNotFoundError: No module named 'num-radix'
ModuleNotFoundError: No module named 'num-radix'  Hi, My Python... 'num-radix' How to remove the ModuleNotFoundError: No module named 'num... have to install padas library. You can install num-radix python with following
ModuleNotFoundError: No module named 'num-shorty'
ModuleNotFoundError: No module named 'num-shorty'  Hi, My Python... 'num-shorty' How to remove the ModuleNotFoundError: No module named 'num... have to install padas library. You can install num-shorty python
ModuleNotFoundError: No module named 'num-solver'
ModuleNotFoundError: No module named 'num-solver'  Hi, My Python... 'num-solver' How to remove the ModuleNotFoundError: No module named 'num... have to install padas library. You can install num-solver python
ModuleNotFoundError: No module named 'num-thai'
ModuleNotFoundError: No module named 'num-thai'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'num-thai' How to remove the ModuleNotFoundError: No module named 'num-thai
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'
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
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
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
ModuleNotFoundError: No module named 'diamond-add-taxonomy'
ModuleNotFoundError: No module named 'diamond-add-taxonomy'  Hi...: No module named 'diamond-add-taxonomy' How to remove the ModuleNotFoundError: No module named 'diamond-add-taxonomy' error? Thanks   Hi
ModuleNotFoundError: No module named 'diamond-add-taxonomy'
ModuleNotFoundError: No module named 'diamond-add-taxonomy'  Hi...: No module named 'diamond-add-taxonomy' How to remove the ModuleNotFoundError: No module named 'diamond-add-taxonomy' error? Thanks   Hi
ModuleNotFoundError: No module named 'snap-plugin-collector-diamond'
ModuleNotFoundError: No module named 'snap-plugin-collector-diamond'  ...: No module named 'snap-plugin-collector-diamond' How to remove the ModuleNotFoundError: No module named 'snap-plugin-collector-diamond' error
ModuleNotFoundError: No module named 'cloudify-diamond-plugin'
ModuleNotFoundError: No module named 'cloudify-diamond-plugin'  Hi...: No module named 'cloudify-diamond-plugin' How to remove the ModuleNotFoundError: No module named 'cloudify-diamond-plugin' error? Thanks   
ModuleNotFoundError: No module named 'diamond-add-taxonomy'
ModuleNotFoundError: No module named 'diamond-add-taxonomy'  Hi...: No module named 'diamond-add-taxonomy' How to remove the ModuleNotFoundError: No module named 'diamond-add-taxonomy' error? Thanks   Hi
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
ModuleNotFoundError: No module named 'big-num-format'
ModuleNotFoundError: No module named 'big-num-format'  Hi, My... named 'big-num-format' How to remove the ModuleNotFoundError: No module named 'big-num-format' error? Thanks   Hi, In your python

Ads