A Program To Print A Equilateral Triangle

Ads
 

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
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();
        }
     }
}

Ads









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
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
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
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
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
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 print using for loop
Write a program to print using for loop  Write a program to print using for loop * * * *  
triangle
triangle  how to draw triangle numbers with stars in html with the help of javascript
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
ModuleNotFoundError: No module named 'my_print_haha_program'
ModuleNotFoundError: No module named 'my_print_haha_program'  Hi...: No module named 'my_print_haha_program' How to remove the ModuleNotFoundError: No module named 'my_print_haha_program' error? Thanks   Hi
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
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 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
simple program
simple program  how to print * like triangle
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
ModuleNotFoundError: No module named 'triangle'
ModuleNotFoundError: No module named 'triangle'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'triangle' How to remove the ModuleNotFoundError: No module named 'triangle
Triangle pgm
Triangle pgm  how to write code fa this??? 1 222 33333 4444444 55555555 666666666
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
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
ModuleNotFoundError: No module named 'Flask-Triangle'
ModuleNotFoundError: No module named 'Flask-Triangle'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'Flask-Triangle' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'Pascal_Triangle'
ModuleNotFoundError: No module named 'Pascal_Triangle'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'Pascal_Triangle' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'Pascal_Triangle'
ModuleNotFoundError: No module named 'Pascal_Triangle'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'Pascal_Triangle' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'right-triangle'
ModuleNotFoundError: No module named 'right-triangle'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'right-triangle' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'triangle_plot'
ModuleNotFoundError: No module named 'triangle_plot'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'triangle_plot' How to remove the ModuleNotFoundError: No module named
print
print  How to print JFrame All Componant?   Please visit the following link: http://www.roseindia.net/java/example/java/swing/Print.shtml
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

Ads