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



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

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Yash Agarwal
A Program To Print A Equilateral Triangle
1 Answer(s)      a year and 10 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
triangle
triangle  how to draw triangle numbers with stars in html with the help of javascript
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
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
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
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 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
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
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
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
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 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
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
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
Triangle pgm
Triangle pgm  how to write code fa this??? 1 222 33333 4444444 55555555 666666666
print
print  How to print JFrame All Componant?   Please visit the following link: http://www.roseindia.net/java/example/java/swing/Print.shtml
Advertisements
 

 

 

DMCA.com