s mahipal
print rectangle triangle with ?*? using loops
3 Answer(s)      4 years and 6 months ago
Posted in : Java Beginners
     *
   *   *
 *   *   *

i want print like this.what is the code?

Advertisement
View Answers

November 9, 2010 at 9:19 PM


import java.lang.*; class Traingles { public static void main(String args[]) {

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



November 9, 2010 at 9:28 PM


class Traingles { public static void main(String args[]) {

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

print("code sample");


November 9, 2010 at 9:28 PM


class Traingles { public static void main(String args[]) {

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

print("code sample");









Related Tutorials/Questions & Answers: