Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners how to make following pyramid using loop

Have Programming Question? Ask it here!
 
 
 


Pragya Thakur
how to make following pyramid using loop
1 Answer(s)      a year and 9 months ago
Posted in : Java Beginners


 1
212

32123 4321234 543212345 4321234 32123 212 1


Advertisement
View Answers

October 15, 2012 at 12:25 PM


Here is a code that displays the following pattern:

     1
    212
   32123
  4321234
 543212345
  4321234
   32123
    212
     1

class Pattern{
  public static void main(String args[]){
    int i,j,k,l;
    for(i=1;i<6;i++){
       for(j=5;j>i;j--)
           System.out.print(" ");
        for(k=i;k>=1;k--)
          System.out.print(k);
            for(l=2;l
               System.out.print(l);

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

         System.out.println("");
         }
    }
 }


Related Tutorials/Questions & Answers:
how to make following pyramid using loop
how to make following pyramid using loop   1 212 32123 4321234 543212345 4321234 32123 212 1   Here is a code that displays the following pattern: 1 212 32123 4321234 543212345
printing the following output using for loop
printing the following output using for loop  1 2 3 3 4 5 4 5 6 7
Advertisements
printing the following output using for loop
printing the following output using for loop  1 2 3 3 4 5 4 5 6 7
pyramid
pyramid  How to get the code for the following pattern * * * * * * * * * *   class Pyramid{ public static void main(String args[]){ for(int i=1;i<=4;i
pyramid
pyramid  How to get the code for the following pattern * * * * * * * * * *   class Pyramid{ public static void main(String args[]){ for(int i=1;i<=4;i
pyramid
pyramid  how to get the output like this A BB CCC DDDD   Hi Friend, Try the following code: class Pyramid { public static void main(String[] args) { for(char ch1='A';ch1<='D';ch1
How to print the following output using c program
How to print the following output using c program  1) 4 3 4 2 3 4 1 2 3 4 2) A B C D E F G H I J
pyramid
pyramid  hi frnds i need java code for pyramid. the pyramid look like this A BAB CBABC BAB
pyramid
pyramid  hi i need java code for pyramid. the pyramid look like this. A BAB CBABC BAB
pyramid
pyramid  how to print 1 22 333 4444 55555   class Pyramid { public static void main(String[] args) { for(int i=1;i<=5;i++){ for(int j=1;j<=i;j++){ System.out.print(i
loop code to print the Pyramid: 1 1234 12 123 123 12 1234 1
loop code to print the Pyramid: 1 1234 12 123 123 12 1234 1  Hi, I want to know how the code to print the pyramid below works. It uses nested for loops. Pyramid: 1 1234 12 123 123 12 1234 1
How to make a chat application using Struts 2 ?
How to make a chat application using Struts 2 ?  Hello, I'm working on my final year project. i've to add chat application in that. how it can be done? 'm using eclipse for that.... plzzz reply
Pyramid
Pyramid  Help me to write the following: 1 121 12321 1234321 123454321   Help me to write the following 1 121 12321 1234321 123454321 thanks
pyramid
pyramid  1 2 2 2 3 3 3 3 3 how to get this pattern what is the logic
pyramid
pyramid  1 2 2 2 3 3 3 3 3 how to get this pattern what is the logic
pyramid
pyramid  1 2 2 2 3 3 3 3 3 how to get this pattern what is the logic
using for loop in javascript
using for loop in javascript  How to use for loop in JavaScript
how to get data from list to map with out using a loop?
how to get data from list to map with out using a loop?  List list...("15"); how to get this data into map with out using a loop. i want this data like this--map.put(name,id); Is it possible to do without using loop
covert the following using java
covert the following using java  how to convert (for eg : 2.89) . this decimal to binary in java
using for loop
using for loop  what will be the source code of the program that the output will be printing all numbers that is divisible by 3 and 5 sample output: 3 is divisible by 3 5 is divisible by 5 6 is divisible by 3 9 is divisible by 3
How to delete the row from the Database by using while loop in servlet
How to delete the row from the Database by using while loop in servlet ... server database by using Servlet program (Tomcat server). In Database table... details. While loop is not terminate, in while loop why If condition
How to write a loop and a while loop
How to write a loop and a while loop  How do I write a 1 loop and a 1 while loop for the example code: public boolean isTheFirstOneBigger (int num1, int num2) { if (num1 > num2) { return true
How to make session control using only JSP programming language
How to make session control using only JSP programming language  Could i do Controlling session using only JSP programming language without using anylanguage
How to make web appliction using spring and hibernate - Spring
How to make web appliction using spring and hibernate  Hi Actually i want to make an web application using spring as front end and hibernate as back...  Hello,Are you using Spring web for developing the application
how to make authentication for each user using jsp/servlet?
how to make authentication for each user using jsp/servlet?  i have 10 jsp pages and 5 users.I use 10 buttons for open the page.Admin assign some jsp pages to each user.If admin assign page1 and page2 for user1 then make other
How to Make HTTP Requests Using Curl and Decoding JSON Responses in PHP
How to Make HTTP Requests Using Curl and Decoding JSON Responses in PHP  Make HTTP Requests Using Curl and Decoding JSON Responses in PHP   ... etc. By using Curl library, You can make http request to a server and get
nmber printed in pyramid format
nmber printed in pyramid format  how to print this format using java 1 23 345 4567 56789
how to get following output
how to get following output  input 123456 output 1 2 3 4 5 6
how to get following output
how to get following output  input 123456 output 1 2 3 4 5 6
number pyramid
number pyramid   how to get the code for the following...;class Pyramid{ public static void main(String args[]){ for(int i=1;i<=7...; class Pyramid{ public static void main(String args[]){ for(int i
how to print the following pattern
how to print the following pattern  Hello hEllo heLlo helLo hellO pls reply soon its an emergency   class StringPattern { public static void main(String[] args) { String st="hello
How to make addition of two combobox values using jsp and javascript?
addition of two combobox values using jsp and javascript  How to make addition of two combobox values using jsp and javascript?  <html> <h2>ComboBox</h2> <script language="javascript"> var arr
Finding duplicates using array in for loop
Finding duplicates using array in for loop  how to find the duplicates in array using for loop
using variable loop
using variable loop  program to print alphabets from a-z along with ASCII codes of each alphabets in two columns using a character variable loop...can anyone help me
how to make this pattern???
how to make this pattern???  how to make following pattern in javascript
Using while loop to loop through a cursor
Using while loop to loop through a cursor  .... Understand with Example The Tutorial grasp you an example on 'Using while loop to loop through a cursor'. The Example create a table Stu_Table
How to make a CRUD without using SQL Server? by just using your GUI? (CRUD = Creating, Register, Update, Delete)
How to make a CRUD without using SQL Server? by just using your GUI? (CRUD... Register Update and delete a account to SQL Server. from now on we have to make a CRUD again without using SQL Server. how to make it? please help
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
 

 

 

DMCA.com