JAVA Overview (8) Cyclic statements (Process Control) (Code practice 2)

Source: Internet
Author: User

Note: The value of X changes as the body increments.


<喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + pgltzybzcm9 "http://www.2cto.com/uploadfile/Collfiles/20140122/2014012209110488.jpg" alt = "\">








Public class ExerciseThree {
Public static void main (String [] args ){
/*

* Follow the steps *
**
***
****
*****
******
*******
External Loop Control
Inner Loop Control Column
External Loop 7 times
Iteration --
Number of columns in an internal loop controlled by an external loop j = I
*/
For (int I = 8; I> 1; I --)

{

For (int j = I; j <9; j ++ ){
System. out. print ("*");
}
System. out. print ("\ n ");
}


For (int I = 0; I <7; I ++)

{
For (int j = 0; j <= I; j ++ ){
System. out. print ("*");
}
System. out. print ("\ n ");
}


/*
* Fight backwards
*/

For (int I = 1; I <7; I ++)

{

For (int j = I; j <7; j ++ ){
System. out. print ("*");
}
System. out. print ("\ n ");
}

For (int I = 1; I <10; I ++)

{

For (int j = I; j <10; j ++ ){
Int a = I * j;
System. out. print (I + "*" + j + "=" + a + "\ t ");
}
System. out. println ();
}
}
}


// String result = "";
//
// For (int I = 0; I <6; I ++ ){
// Int inVal = (int) (Math. random () * 26 + 97 );
// Result = result + (char) inVal;
//}
// System. out. println (result); a random sequence string is generated.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.