Share on Google+Share on Google+

Nishant Jain
Description
1 Answer(s)      6 years and 2 months ago
Posted in : Java Beginners

public class PatternExample{ public static void main(String[] args){

int i,j,n=5;

for(i=0;i<=n;i++) { System.out.println(); for(j=1;j<=n-i;j++) System.out.print(j); for(j=0;j<2*i;j++) System.out.print(" "); for(j=n-i;j>0;j--) System.out.print(j); } } } OUTPUT IS

1234554321 1234 4321 123 321 12 21 1 1

PLZ DESCRIBE ME THAT HOW TO MAKE THIS PROGRAM AND WHATS THE WORKING OF EVERY LOOP

Ads

View Answers

February 25, 2011 at 3:37 PM


The above code consists of four loops. The first loops create the five rows. The second loop first increment the value of j by decrement the value of n. The third loop provides the incremented space. The fourth loop first decrement the value of j.










Related Tutorials/Questions & Answers:
Advertisements
full description of program code
full description of program code  import java.util.*; class StringExample6 { public static void main(String[] args) { Scanner input.... i've a problem that plz describe me full description of this code thanks
full description of program code
full description of program code  import java.util.*; class StringExample6 { public static void main(String[] args) { Scanner input.... This is the full description for your second output
full description of program code
full description of program code  escribe me below code how this program code is make and work, and those method is use in this why? import java.util.*; class SortList { public static void main(String[]args) { Scanner input=new
how to get description for each file
how to get description for each file  hi, how to get description... file if the user select 10 file to upload........get the description for each file without description dont upload..... u have any idea......code
Website Description Data Scraper & Image/Thumbnail Generator
Website Description Data Scraper & Image/Thumbnail Generator   I need Image/Thumbnail Generator code in java. Please help me
Website Description Data Scraper & Image/Thumbnail Generator
Website Description Data Scraper & Image/Thumbnail Generator   This is yhoo I need Image/Thumbnail Generator code in java. Please help me
Match EJB roles with the corresponding description of the role's responsibilities, where the description may include deployment descriptor information.
with the corresponding description of the role's responsibilities, where the description... with the corresponding description of the role's responsibilities, where the description may include deployment descriptor information. There are 6
GoogleJsonResponseException code: 400 : The request metadata specifies an invali d video description.
an invali d video description.  Hi, I have made a Java program to upload... specifies an invali d video description... video description.", "reason" : "invalidDescription" } ], "message
description about jdk 1.5 features - Hibernate Interview Questions
description about jdk 1.5 features  Hi. Please can anyone provide the details description regarding the new features available in jdk 1.5....  Hi friend, JDK : JDK is a software development program provided
java code for accept city name and gives temparature,wind speed,humidity exts along with description
java code for accept city name and gives temparature,wind speed,humidity exts along with description  java code for accept city name and gives temparature,wind speed,humidity exts along with description
Match the correct description about purpose and function to which session bean type they apply: stateless, stateful, or both.
Match the correct description about purpose and function to which session bean type they apply: stateless, stateful, or both. Prev ...;   Match the correct description about purpose and function
Description of Database Table
Description of Database Table     ... or not, whether the column is unique or primary and much more. Description... the detail description of table. When the program will gets execute then it will show
Description of EJB 3
Description of EJB 3     Enterprise beans are the Java EE server side components that run inside the ejb container and encapsulate the business logic of an enterprise application. EJB3
Description of GlassFish Application Server
Description of GlassFish Application Server     GlassFish is a free, open source application server that implements the newest features in the Java EE 5 platform. The Java EE 5 platform includes
Match the name with a description of purpose or functionality, for each of the following deployment descriptor elements: ejb-name, abstract-schema-name, ejb-relation, ejb-relat
Match the name with a description of purpose or functionality, for each of the following deployment descriptor elements: ejb-name...) Next     Match the name with a description of purpose
Technical description of Java Mail API
Technical description of Java Mail API       This section introduces you with the core concepts of Java Mail API. You must understand the Java Mail API before actually delving
Collection : LinkedList Example
This tutorial contains description of Collection LinkedList with example
Collection : ArrayList Example
This tutorial contains description of Collection ArrayList with example
Hibernate Caching
This tutorial contains description about Hibernate Caching
Hibernate : Dynamic-insert
This tutorial contains description of Hibernate dynamic-insert
Hibernate Session Load
This section contain description of Hibernate session load
Hibernate :Clear Session ,Close Session
This part contains description of Hibernate session.clear() and session.close.
Hibernate Date Format
This section contains description of Hibernate Date Format
Hibernate Named Query
This section contain description of named query with example
Hibernate Life Cycle
This tutorial contains full description of Hibernate life cycle
Ordering of web fragments
This section contains the detailed description on Ordering of web fragments
Tutorials   
Java Spring Hibernate Struts Training Retrieve database from the table dynamically in jsp from oracle using servlet What does core Java include? java What are some way to learn Java quickly? Is it required to learn Java before learning Java Script? Is it necessary to learn java script before learning PHP? Are HTML5 and Java Script boosts Java career? Is Java object oriented? Fingerprint application with Java Uninstall Oracle Virtual Box JSON to HashMap Free Java online Training I want example of Control Statement in Java ANSI Color Codes with Python Create a Program that Calculates Input What is difference between JDK,JRE and JVM? How to see ubuntu version on server? How to get Page Source in Selenium (WebDriver) using Java? The path to the driver executable must be set by the webdriver.gecko.driver system property parse data from a link in java Java Program Qns using BlueJ How to fix HAX Kernel Module Is Not Installed error? Installing Audacity Looking for code Logic to check track changes & Coments in MSWord, MSWordx, MSExcel, MSExcelx is ON/OFF Installing JDK on Mac SAX Parser exception ERROR 601 (42P00): Syntax error. Encountered Thread java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory How to install Ubuntu 16.04 LTS? HttpServletRequest cannot be resolved to a type in eclipse - Solved Unhandled event loop exception GC overhead limit exceeded Spring Data jpa with apache phoenix Caused by: java.lang.IllegalArgumentException: Not a host:port pair: PBUF o.a.h.h.z.RecoverableZooKeeper - Possibly transient ZooKeeper, quorum= com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager class not found com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager not found How to download and install Java 8 on Windows? How to uninstall JDK 7? How to install gtk-doc-tools package in Ubuntu? How to install Oracle JDK 8 on Ubuntu? ejabberd_ctl.beam not found - Solved How to convert date to UTC format in Java? How to install autoconf, automake and libtool in Ubuntu 15.10? How to convert current date to mm dd yyyy format in Java? How to convert current date to dd mm yyyy format in Java? How to stop window closing in "internalFrameClosing" event. How to find list of all index in Neo4j? neo4j-server.properties file location SASLError using PLAIN: not-authorized

Ads

 
Advertisement null

Ads