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 * **

View Answers

April 17, 2012 at 11:39 AM

java diamond shape:

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();
}
}
}

April 17, 2012 at 11:40 AM

public class PrintDiamond {
public static void main(String[] args) {
int n = 5;
for (int i = -n; i <= n; i++) {
for (int j = -n; j <= n; j++) {
if (Math.abs(i) + Math.abs(j) <= n){
System.out.print("* ");
}
else {
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
looping
looping   sum of the series s=1+2/1*2
Advertisements
looping ..
looping ..  can i get coding for get the following output: (using looping) 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144
Flex Looping
Flex Looping  I need example for flex looping mechanisam example
looping structures in JavaScript
looping structures in JavaScript  What looping structures are there in JavaScript
looping with strings
looping with strings  how to print this w we wel welc welco with loop?   import java.util.*; class StringExample3 { public static void main(String[] args) { Scanner input=new Scanner(System.in
looping
ModuleNotFoundError: No module named 'looping'
ModuleNotFoundError: No module named 'looping'  Hi, My Python... 'looping' How to remove the ModuleNotFoundError: No module named 'looping... to install padas library. You can install looping python with following command
ModuleNotFoundError: No module named 'looping'
ModuleNotFoundError: No module named 'looping'  Hi, My Python... 'looping' How to remove the ModuleNotFoundError: No module named 'looping... to install padas library. You can install looping python with following command
ModuleNotFoundError: No module named 'looping'
ModuleNotFoundError: No module named 'looping'  Hi, My Python... 'looping' How to remove the ModuleNotFoundError: No module named 'looping... to install padas library. You can install looping python with following command
looping programm of sum
looping programm of sum  s=1+2/12+1+2+3/12*3+1+2+3+..... n
Flex Looping
.style1 { border-style: solid; border-width: 1px; background-color: #FFFFCC; } Executing a set of statements repeatedly is performed through looping. For this purpose, Flex provides some looping mechanism like: 1
Ask about looping in database
Ask about looping in database  Good afternoon, I want to ask... that how to read looping in field rights(if A1=false and A2 = True), use from java. i want to call rights looping with code program from java. i read from datatase
ModuleNotFoundError: No module named 'looping_list'
ModuleNotFoundError: No module named 'looping_list'  Hi, My Python... 'looping_list' How to remove the ModuleNotFoundError: No module named 'looping_list' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'anaharid-looping'
ModuleNotFoundError: No module named 'anaharid-looping'  Hi, My... named 'anaharid-looping' How to remove the ModuleNotFoundError: No module named 'anaharid-looping' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'looping_list'
ModuleNotFoundError: No module named 'looping_list'  Hi, My Python... 'looping_list' How to remove the ModuleNotFoundError: No module named 'looping_list' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'looping_list'
ModuleNotFoundError: No module named 'looping_list'  Hi, My Python... 'looping_list' How to remove the ModuleNotFoundError: No module named 'looping_list' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'anaharid-looping'
ModuleNotFoundError: No module named 'anaharid-looping'  Hi, My... named 'anaharid-looping' How to remove the ModuleNotFoundError: No module named 'anaharid-looping' error? Thanks   Hi, In your
looping through a list of methods
looping through a list of methods  I have a number of methods that do the almost same thing: public void setColorRed (int colorvalue); public void setColorYellow (int colorvalue); public void setColorBlue (int colorvalue
farbonicci in looping - Spring
farbonicci in looping  how to make a program use farbonicci in looping?  import java.io.*; public class FibonciiExample{ public static void main(String[] args) throws Exception{ System.out.println("Fibonccii
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'
Mysql Looping
Mysql Looping       Looping in Mysql is a simple loop construct,that enables the repeated... 'Mysql Looping'.To understand this example we create a procedure 'ABC
Mysql Looping
Mysql Looping       Looping in Mysql is a simple loop construct, that enables the repeated execution... with ExampleADS_TO_REPLACE_1 The Tutorial illustrate an example from 'Mysql Looping
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
Example of Looping in Python
Example of Looping in Python - Learn looping in Python Let's learn looping in Python with the example code. What is Loop? In computer programming... once counter increased more than 100. ADS_TO_REPLACE_1 Looping in programming
Looping Statements in java 7
Looping Statements in java 7 In this section, we will discuss about Looping Statements in java 7. This is one type of control flow statement. Looping... of statements repeatedly. Following are three types of Looping statements - ADS
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
Unable looping using JOptionPane - Java Beginners
Unable looping using JOptionPane  import javax.swing.*; public class Shop{ public static void main(String [] args){ Shop shop = new Shop(); String mainMenu= "(MAIN SCREEN )"; mainMenu+= "\n1) Computer Menu
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

Ads