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



Home Answers Viewqa Java-Beginners print rectangle triangle with ?*? using loops
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


s mahipal
print rectangle triangle with ?*? using loops
3 Answer(s)      4 years and 2 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:
Advertisements
 

 

 

DMCA.com