Wednesday, January 7, 2009

Sayings For Football Shirts

Exercise 5.20 How to program in java

avaEjercicio of the book "How to program in java" Type 5.10 an application that displays the following patterns separately, one below another. Use for loops to generate the patterns. All asterisks (*) must be printed by a single statement of how System.out.printl ("*"); which causes the asterisks to be printed next to each other. public class

Cinco10 {public static void main (String [] args) {String output = ""; otravez: for (int f = 1; f output + = "\\ n"; for (int c = 1, c

if (c> f) continue otravez; +="*"; output}} System.out.println (output);

/ / Second drawing out = ""; otravez:

for (int f = 1; f output + = "\\ n";

for (int c = 10, c> = 1, c -)

{if (c

for (int y = 0; and System.out.print ("");

} for (int z = 10, z> = 1 + x, z -) { System.out.print

("*") ;

} System.out.println (); x + +;


} / / fourth drawing x = 10; while (x> 0) {

for (int y = x, y> = 0, y -) { System.out.print ( "");}

for (int z = 0, z

System.out.print ("*");

}

System.out.println ();

x -;}

}}

Result:



0 comments:

Post a Comment