Saturday, February 23, 2013

array

public class array2
 {
 public static void main( String args[] )
 {
 int array[] = { 0, 0, 0, 0, 0, 0, 1, 2, 4, 2, 1 };

 System.out.println( "Grade distribution:" );


 for ( int counter = 0; counter < array.length; counter++ )
 {

 if ( counter == 25 )
 System.out.print(  200 );

 else
 System.out.printf( "%02d-%02d: ",

 counter * 25, counter * 10 +24 );
 for( int stars = 0; stars < array[ counter ]; stars++ )

System.out.print( "*" );

System.out.println();

}

}

}

No comments:

Post a Comment