PYRAMID 1 Answer(s) 4 years and 10 months ago
Posted in : Java Beginners
View Answers
August 13, 2008 at 11:52 AM
Hi friend,
import java.io.*; import java.io.IOException;
public class PiramidTest{ final static int WIDTH = 10; public static void main(String args[])throws Exception{ System.out.println("Piramid example"); BufferedReader buff=new BufferedReader(new InputStreamReader(System.in)); String str="y"; while(str.equals("Y")||str.equals("y")){ System.out.print("Enter the String value:"); String s=buff.readLine(); if(s.equals("A")){ for (int i = 1; i <= WIDTH; i++) { for (int j = 1; j <= WIDTH - i; j++) { System.out.print(" "); } for (int j = 1; j <= 2*i - 1; j++) { System.out.print("*"); } System.out.println(); } System.out.println();
} if(s.equals("B")){ for (int i = 1; i <= WIDTH; i++) { for (int j = 1; j <= WIDTH - i; j++) { System.out.print(" "); } for (int j = 1; j <= 2*i - 1; j++) { System.out.print("*"); } System.out.println(); } System.out.println(); } if(s.equals("C")){ for (int i = 1; i <= WIDTH; i++) { for (int j = 1; j <= 2*i - 1; j++) { System.out.print(""); }
for (int j = 1; j <= WIDTH - i; j++){ System.out.print("*"); } System.out.println(); } System.out.println(); } System.out.print("would you like to Continue y or n:"); str=buff.readLine(); } } } ------------------------------------------
Thanks & regards
Amardeep
Related Pages:
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
number pyramid
;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
for the following number pyramid:
print.... So far I have this:
print("import java.util.Scanner;
class Pyramid {
public... Pyramid {
public static void main(String[] args) {
Scanner input = new Scanner
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
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
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
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
java loops - Java Beginners
java loops Q1 print the following pyramid
*
* *
* *
* *
* *
* * * * * * * * * * *
 ... to help in solving the problem :
class Pyramid
{
public static void main
java loops - Java Beginners
java loops Print the pyramid
--------- *
--------* *
* *
* *
* *
* * * * * * * * * * *
Hi friend,
Use the following code:
class Pyramid
{
public static
hi friend - Java Beginners
hi friend ummm i want to know a java code ...what are the code if i want to display inverted pyramid(shape).
i mean a pyramid is reversed down....
thank u friends!!! Hi friend,
Inverted pyramid code
class
loop example
loop example 1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
can you give me the code to get the number pyramid
using array
using array display 10 digit number using array and print pyramid.
1
1
1 1
1 1 1 1
1 1 1 1
c++ - Java Beginners
c++ 2. Use for loops to construct a program that displays a pyramid of Xs on the screen. The
pyramid should look like this
X
XXX
XXXXX
XXXXXXX
XXXXXXXXX
except that it should be 20 lines high, instead of the 5 lines shown
java - Java Beginners
java write a program in a pramid like
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 4 5 4 3 2 1 Hi Friend,
Try the following code:
class Pyramid{
public static void main(String[] args
java - Java Beginners
java write a program in java to print the number as follow;
1
2 1
3 2 1
4 3 2 1
5 4 3 2 Hi Friend,
Try the following code:
class Pyramid
{
public static void main(String[] args
java loops - Java Beginners
java loops Q1 print the following pyramid?
-------------*
-----------* *
---------* *
-------* *
-----* *
---* * * * * * * * * * * *
Q2-write a recursive function to add two
Java Program - Java Beginners
Java Program Write a program to print the following output using the for loop.
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5 Hi Friend,
Try the following code:
class pyramid{
public static void main(String[] args){
int i
java - Java Beginners
java Q1 write aprogram to print the pyramid?
-------------*
-----------*---*
---------* ----- *
-------*-----------*
-----*----------------*
---* * * * * * * * * * * *
This is really simple because all you
print numbers in traingle shape
print numbers in traingle shape 1
22
333
4444
i want output like this please help me
class Pyramid
{
public static void main(String[] args)
{
for(int i=1;i<=4;i++){
for(int j=1;j<
JAVA PROGRAMMING
JAVA PROGRAMMING WAP to generate the following Series
* * * * *
* * * *
* * *
* *
*
class Pyramid{
public static void main(String[] args
java
java Hi,
can any one please share the code to print below pyramid
*
**
***
****
*****
Here is a code that displays given pattern:
*
**
***
****
*****
public class Pattern {
public static void
java - Java Beginners
java I want to know a java program that using For Loop which will display triangle or pyramid...
The user must choose A, B, or C... it will display a Pyramid
java - Java Beginners
java give the code in java for the following programs:
1. 5
45
345
2345
12345
2. H
HE
HEL
HELL
HELLO Hi Friend,
1)
class Pyramid
{
public static
Fresher-Trainee
Fresher-Trainee the below pgm has an exception during run time, and has no errors during compilation , pls help. wat to do?
class Pyramid
{
public static void main(String[] args)
{
int x = 9;
for (int i
java
;class Pyramid{
public static void main(String[] args){
int i,j,k,n
java - Java Beginners
will display triangle or pyramid...
The user must choose A, B, or C... it will display a Pyramid... java.io.*;
import java.awt.*;
public class pyramid
{
public static void main
C# - Java Beginners
C# program to print the following:
1
1 1
1 2 2 1
2 3 3 3 2
3 4 4 4 4 3
4 5 5 5 5 5 4 Hi Friend,
We are sending you the code of your pattern in java.
class Pyramid
{
public static void
Java program question ...
the number from the user. Accordingly, the pyramid of aestricks is displayed.
import
Java Numeric Pyramids - Java Beginners
:
___________________________________________________________________________
public class Pyramid {
public static void main...
_______________________________________________________________________
public class Pyramid {
public static void main(String[] args) {
int k
star
;hr />
plzzzz help me</p>
class Pyramid{
public
hello - Java Beginners
hello I want to know a java program that using For Loop which will display triangle or pyramid...
The user must choose A, B, or C...: A
(so it will display a Pyramid OR TRIANGLE