Flow Control Structure Map:
Today we mainly learn how the statement of Process control is used:
If format:
if (condition) {
Loop body
}
Condition of the re-execution loop body
while (condition) {
}
Here are some small programs written with circular statements
for (int i = 1;i <= 100;i++ if (i% 2! = 0 continue ; // continue ends this loop } // break ends this layer loop System.out.println (i); Output 100 or even} for (i NT i = 1;i <= 100;i++) { if ( ! (i% 7 = = 0 | | i/10 = = 7 | | I% = = 7//Every 7 games}
for(inti = 0;i < 10;i++) { for(intK = 0;k <= math.abs (i-4); k++) {System.out.print (" "); } for(intj = 1; J <= ((5-math.abs (i-4)) * 2-1); J + +) {System.out.print ("*"); } System.out.println (); } //to print a diamond with a * for(inti = 1; I < 10;i++) { for(intj = 1;j <= i; J + +) { intC = J *i; System.out.print (J+ "*" + i + "=" + C + ""); } System.out.println (""); } //Printing multiplication Tables
Today we mainly learn some usages of the commonly used circular statements.
Java Basic Process Control