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



Home Answers Viewqa Java-Beginners A Program To Print A Equilateral Triangle

Have Programming Question? Ask it here!
 
 
 


Yash Agarwal
A Program To Print A Equilateral Triangle
1 Answer(s)      a year and 9 months ago
Posted in : Java Beginners


Write A program to Print Following In Java :

           1
         1 1 1
       1 1 1 1 1
     1 1 1 1 1 1 1
   1 1 1 1 1 1 1 1 1
 1 1 1 1 1 1 1 1 1 1 1

Advertisement
View Answers

November 21, 2012 at 12:07 PM


Here is a code that shows following pattern:

           1
         1 1 1
       1 1 1 1 1
     1 1 1 1 1 1 1
   1 1 1 1 1 1 1 1 1
 1 1 1 1 1 1 1 1 1 1 1

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


Related Tutorials/Questions & Answers:
A Program To Print A Equilateral Triangle
A Program To Print A Equilateral Triangle  Write A program to Print Following In Java : 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
How to print a equilateral triangle patren with numbers
How to print a equilateral triangle patren with numbers  I figure out how to use for loop to print the triangle but i couldn't get the exact values as this http://im37.gulfup.com/FzrOb.jpg could you please help me
Advertisements
C Program to Print Pascal Triangle - Development process
C Program to Print Pascal Triangle  I want C Program to Print Pascal Triangle.  Hi Friend, Try the following code: #include #include void main(){ int a[15][15],i,j,rows,num=25,k; printf("\n enter
how to write a program in java to print numbers in equalateral triangle
how to write a program in java to print numbers in equalateral triangle  the output must be 1 324 76589   Here is an example of pattern 1 2 3 4 5 6 7 8 9 Example: public class NumberTriangle{ public
Triangle program
a program for this triangle    1 121 12321 1234321 write a program for this triangle    1 121 12321 1234321 write a program...Triangle program  1 121 12321 1234321 123454321 kindly give
Triangle Program
Triangle Program  i want program code for 1 2 3 4 5 6 7 8 9 10 any body please help me   public class Triangle { public static void main(String[] args
Java Program Floyd's Triangle
Java Program Floyd's Triangle In this section you will read about how to write a Java program to print Floyd's triangle. This tutorial is about... for creating the Floyd's triangle in Java. Before writing a Java program
print rectangle triangle with ?*? using loops
print rectangle triangle with ?*? using loops   * * * * * * i want print like this.what is the code?   import java.lang....("*"); } } System.out.print(" "); } } print("code sample");   class Traingles { public
triangle
valid integers will be entered) Determine and print if they could represent the sides of a triangle If they can form a triangle, determine and print if they can...triangle  Write a program that makes use of a class called
C Print Pascal Triangle
C Print Pascal Triangle In this section, you will learn how to display Pascal's triangle. A Pascal's triangle is a geometric arrangement of the binomial coefficients in a triangle.The rows of Pascal's triangle are conventionally
triangle
triangle  how to draw triangle numbers with stars in html with the help of javascript
program to print total marks
program to print total marks  program to input total marks out of 600 marks as an argument and print the stream allotted using the following criteria 401 & above - PCM 301-400 - ZBC 201-300- Commerce 101-200 - Arts
write a program to print
write a program to print   write a program to print following 1 2 3 4 5 4 3 2 1 1 2 3 4 4 3 2 1 1 2 3 3 2 1 1 2 2 1 1 1
C program to print the following
C program to print the following  Hello, Some one help me with a "C Program" to print the following as output: 4444444 4333334..., that is why I choosed Java Beginners, but please give me a C program
Write a program to construct a triangle with the ?*?
Write a program to construct a triangle... of times we have to print *.  Now compile and run the program and insert... programming will teach you the coding for constructing a shape of triangle by using
Write a program to print using for loop
Write a program to print using for loop  Write a program to print using for loop * * * *  
C program - Java Magazine
of a right-angled triangle, equilateral triangle, isosceles triangle or a scalene..., the program should print the following; The three integers form a Right-angled...", &c); if((a==b)&&(b==c)&&(c==a)){ printf("Equilateral Triangle \n
triangle output
triangle output  program to get the following output
write a program to use for loop print **********========== in c language
write a program to use for loop print **********========== in c language  write a program to use for loop print **========== in c language
write a program in C to print following triangles on the screen
write a program in C to print following triangles on the screen  write a program in C to print following triangles on the screen
triangle output
triangle output  program to get the following output: * *   Hi Friend, Please specify the pattern properly. Thanks
C Program to Print Following Output - Development process
C Program to Print Following Output  Hello Sir I wnat to print Followning output in C Language with for loop How I Can Print it? 5 5 4 5 4 3 5 4 3 2 5 4 3 2 1  Hi Friend, Try the following: #include
C Program to Print Stras - Development process
C Program to Print Stras  How I can Print Following Output using Two For loops in C Language? * * * * * * * * * * * * * * * *  Hi Friend, Try the following: #include #include void main(){ int i=0
pascal triangle
pascal triangle   given string : char str[]="123456789"; write a program in 'c'-language that displays the following: 1 232... the following link: C Pascal's Triangle Thanks
java program - Java Beginners
of the triangle and then the program; a)First determines whether the 3 integers entered represent the sides of a right-angled triangle, equilateral triangle, isosceles...java program  what is the program the a simple program in Java
Triangle problem
Triangle problem  what's the logic for create pattern program how can i create any pattern program with in minute. like this 1 2 5 3 6 8 4 7 9 10
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
triangle shape
triangle shape  Hi, I have to create a program which its output is: + ++ +++ ++++ and this what I did so far : package symbols; import... symbol; System.out.print(" how many lines you want to print? "); nline
WRITE A PROGRAM TO PRINT OUT THE NUBERS 10 THROUGH 49
WRITE A PROGRAM TO PRINT OUT THE NUBERS 10 THROUGH 49   write a program to print out the number 10 through 49 in the following manner 10 11 12 13 ......19 20 21..............29 30 31..............39 40 4142............49
print
print  How to print JFrame All Componant?   Please visit the following link: http://www.roseindia.net/java/example/java/swing/Print.shtml
Triangle pgm
Triangle pgm  how to write code fa this??? 1 222 33333 4444444 55555555 666666666
Code for a triangle.....
Code for a triangle.....   1 1 5 1 1 5 25 5 1 What is the source Code for above output
Print
into the stream and, as opposed to print() method, gets you to the new line after the text
Floyd's triangle
Floyd's triangle  Write a 'for' statment that will print Floyd's traingle.   Hi Friend, Try the following code: public class FloydTriangleExample { public static void main(String[] args) throws Exception { int k=0
Write a java program that prints the decimal representation in reverse. (For example n=173,the program should print 371.)c
Write a java program that prints the decimal representation in reverse. (For example n=173,the program should print 371.)c  class rose { int n...); System.out.println("\nReverse the number"+i); S.out(); } }   print
Golden triangle tours
Golden triangle tours  Hi, Can anyone tell me something about Golden triangle tours? Thanks   Hi, Golden Triangle tour cover Delhi, Agra and Jaipur. Please check India Golden Triangle Tours. Thanks
Java create triangle pattern
Java create triangle pattern In this tutorial, you will learn how to create a triangle shape. For this, user is allowed to enter number of lines to display the triangle of that length and a symbol to show the triangle in a particular
Golden Triangle Tours
Golden Triangle Tours  What is golden triangle tours ..and how it is related to the Agra and Jaipur and Delhi trip? Please explain me. Thanks
How to calculate area of triangle
tutorial program in the section you see that how to get triangle values. First... of triangle. Then the program perform and  return of triangle value... Area of Triangle      
write a java program to print marklist of "n " students. input Register number, name and marks of three subjects.
write a java program to print marklist of "n " students. input Register number, name and marks of three subjects.  write a java program to print marklist of "n " students. input Register number, name and marks of three subjects
simple program
simple program  how to print * like triangle
Modify the sales tax program to accept an arbitrary number of prices, total them, calculate the sales tax and print the total amount.
Modify the sales tax program to accept an arbitrary number of prices, total them, calculate the sales tax and print the total amount.  Modify the sales tax program to accept an arbitrary number of prices, total them, calculate
PLEASE Help me write a Java program which will store, manipulate, and print student registration information.
PLEASE Help me write a Java program which will store, manipulate, and print..., ADDRESS AND ADMISSIONS CLASS PLEASE HELP!!! Write a Java program which will store, manipulate, and print student registration information. As part
how to perform a equqlity triangle in java
how to perform a equqlity triangle in java  below the output 1 2 3 4 6 5 7 9 10 8
TRIANGLE OF *S AT THE BOTTOM RIGHT!!! - Java Beginners
TRIANGLE OF *S AT THE BOTTOM RIGHT!!!  My Question is to : "Write a program that inputs one integer m and outputs an m-line high triangle of *'s... to make the triangle at the right side but couldn't do so. Can you please solve
Java draw triangle draw method?
Java draw triangle draw method?  hi how would i construct the draw method for an triangle using the 'public void draw (graphics g ) method? im...; Here is an example that draws a triangle using drawPolygon method. import
srinu
srinu  how to print a equilateral triangle (*) in java
how to perform a equqlity triangle in java
how to perform a equqlity triangle in java  below the output 1 2 3 4 6 5 7 9 10 8   Here is an example of pattern like 1 2 3 4 5 6 7 8 9 10 Example : public class NumberTriangleClass{ public static void
print a form of *
print a form of *   * *** ***** ******* ********* ******* ***** *** *   Post the format properly
print the newline
print the newline  Why doesn?t the following code print the newline properly? <?php $str = ?Hello, there.\nHow are you?\nThanks for visiting.?; print $str; ?>   Hi friends, Inside the single quotes \n (newline
Advertisements
 

 

 

DMCA.com