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




Have Programming Question? Ask it here!
 
 
 


abhisek ray
number pyramid
3 Answer(s)      2 years and 2 months ago
Posted in : Java Beginners


   how to get the code for the following :       
             1
            123
           12345
          1234567

Advertisement
View Answers

February 13, 2012 at 1:23 PM


class Pyramid{
   public static void main(String args[]){
       for(int i=1;i<=7;i+=2){
          for (int j = 0; j < 9-i; j++){
         System.out.print(" ");
       }
           for(int j=1;j<=i;j++){
               System.out.print(j+" ");
           }
           System.out.println();
       }
   }
}


February 13, 2012 at 1:31 PM


class Pyramid{
   public static void main(String args[]){
       for(int i=1;i<=7;i+=2){
          for (int j = 0; j < 9-i; j++){
         System.out.print(" ");
       }
           for(int j=1;j<=i;j++){
               System.out.print(j+" ");
           }
           System.out.println();
       }
   }
}


May 8, 2012 at 6:25 PM


public void pyramid5(int n) { for(int i=1;i<=n;i++)

    {
        for(int j=0;j<n-i;j++)
        {
            System.out.print(" ");
        }
        for(int j=1;j<=i;j++)
        {

            System.out.print(j);


        }
        for(int j=1;j<=i-1;j++)
        {
            System.out.print(j);
        }
        System.out.println("");
    }
}


Related Tutorials/Questions & Answers:
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
Number Pyramid
Number Pyramid  Hi Everyone, Can someone help me write the code for the following number pyramid: print... 0 0 0 0 4 ... "); There is 5 spaces in between each number
Advertisements
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 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
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 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
nmber printed in pyramid format
nmber printed in pyramid format  how to print this format using java 1 23 345 4567 56789
Application for print pyramid of numbers
Application for print pyramid of numbers  What is the code for printing the numbers like 1 1 1 1 2 2 1 1 3 4 3 1 1 4 7 7 4 1
Java Pyramid of Numbers
Java Pyramid of Numbers  Hi, I want to know how the code to print the pyramid below works. It uses nested for loops. Pyramid: 1 2 1 2
PYRAMID - Java Beginners
will display triangle or pyramid... The user must choose A, B, or C...: A (so it will display a Pyramid OR TRIANGLE) would you like to continue y... OR PYRAMID NOTE: SORY I TRY TO DRAW A PYRAMID OR TRIANGLE BUT IT WILL NOT DISPLAY
Pyramid Multiplex Online movie ticket booking
Pyramid Multiplex Online movie ticket booking  Pyramid multiplex.... Pyramid multiplex currently has 5 theatres now. Each theatre currently has... to browse through the movies running in Pyramid complex for any given date
Printing numbers in pyramid format - Java Beginners
Printing numbers in pyramid format  Q) Can you please tel me the code to print the numbers in the following format: 1... the following code: public class Pyramid{ public static void main (String
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
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
buzz number
buzz number  buzz number
prime number
prime number  get one number and check the number prime or not using if statement   Java Check Prime Number
the number of parameters
the number of parameters  How do I find out the number of parameters passed into function
Number in array
Number in array  How to write a program to check the number that we are entered from keyboard is in the given array
prime number
prime number  check prime number using if statement   Java Check Prime Number
prime number
prime number  check prime number using if statement   Java Check Prime Number
prime number
prime number  To check a number entered by user is prime or not?   Java check prime number import java.util.*; class CheckPrimeNumber { static boolean isPrime(int number){ boolean isPrime=false
prime number
prime number  could u pls help me out in finding whether a number is a prime number or not?   import java.util.*; class CheckPrimeNumber { static boolean isPrime(int number){ boolean isPrime=false
prime number
prime number  To check a number entered by user is prime
Armstrong number
Armstrong number  I want java program for Armstrong number
prime number
prime number  to check wethere given number is prime or not?  ... { static boolean isPrime(int number){ boolean isPrime=false; int i=(int) Math.ceil(Math.sqrt(number)); while (i>1
prime number
prime number  HI!I want a java program that accepts a number from user and displays whether it is a prime number or not using BufferedReader
Count number of "*"
Count number of "*"  I have this code to count the number of * from a string entered. but I need to find it from an text file. Any idea? import...++; } } System.out.println("The number of vowels in the given sentence
number sorting
number sorting  program to sort a list of numbers in descending order where the inputs are entered from keyboard in runtime   Hi Friend, Try the following code: import java.util.*; class SortListInDescendingOrder
random number
random number   Please How do I generate a program that gives me random integer from 115 to 250? Using java.util.random. Thank you very much!   Hi Friend, Try the following code: import java.util.*; public final
Primary number
Primary number  write a program to find the 100th or nth primary number?   import java.util.*; class PrimeNumber{ public static void main(String a[]) { Scanner input=new Scanner(System.in
Primary number
Primary number  write a program to find the 100th or nth primary number?   import java.util.*; class PrimeNumber{ public static void main(String a[]) { Scanner input=new Scanner(System.in
VoIP Number
VoIP Number VoIP Numbers With a VoIPtalk Incoming number, callers can reach you by calling a UK number no matter where you are, Simply plug... connection and anyone can reach you by dialling your individual number. The VoIPtalk
to read number from user
to read number from user  1)print the positive equivalent of the number 2) check if the no is integer or not 3) find the square root of the number 4) find the cube of the number
number - Java Interview Questions
number  apka number kya hai aap apna number mera id per send ker do
NUMBER OF VOWELS IN A WORD
NUMBER OF VOWELS IN A WORD  WRITE A PROGRAM THAT WILL INPUT A WORD THEN IT WILL DETERMINE THE NUMBER OF VOWELS PRESENT IN THE INPUTTED WORD
using random number
using random number  generate a 10 digit number using random number and display the length of longest increasing series
To check a palindrome number?
To check a palindrome number?  program to check a number is palindrome or not using recursion?(wihout converting to string
port number - JavaMail
port number  i want james2.1.3 port number like microsoft telnet>open local host _______(some port number) i wnat that port number
finding divisors of a number
finding divisors of a number   write a c program to input a number and print all its divisors using while loop
finding divisors of a number
finding divisors of a number   write a c program to input a number and print all its divisors using while loop
finding divisors of a number
finding divisors of a number   write a c program to input a number and print all its divisors using while loop
 

 

 

DMCA.com