Print? Public class AppMain {
Public static void main (String [] args ){
AppMain appMain = new AppMain ();
AppMain. caculate ();
AppMain. test2 ();
AppMain. multiplicationTable ();
AppMain. addAdd ();
AppMain. addFactorial ();
}
/*
* Use the while loop to calculate the sum of the odd and even numbers within 100
*/
Void caculate (){
Int sumOdd = 0;
Int sumEven = 0;
For (int I = 0; I <100; I ++ ){
If (I % 2 = 0 ){
SumEven + = I;
} Else {
SumOdd + = I;
}
}
System. out. println ("sum of even numbers in 100:" + sumEven );
System. out. println ("sum of the odd numbers in 100:" + sumOdd );
}
/*
* Output the number of all vertices divided by 5 in 1000 in a cyclic structure, and output a maximum of three records per line.
*/
Void test2 (){
Int I = 0, j = 0;
While (I <1000 ){
If (0 = I % 5 ){
System. out. print (I + "\ t ");
J ++;
If (0 = j % 3 ){
System. out. println ("\ n ");
J = 0;
}
}
I ++;
}
}
/*
* Output the 9-9 multiplication table
*/
Void multiplicationTable (){
System. out. println ();
For (int I = 1; I <10; I ++ ){
For (int j = 1; j <= I; j ++ ){
System. out. print (j + "*" + I + "=" + (I * j <10? ("" + I * j): I * j) + "");
}
System. out. println ();
}
}
/*
* Request: 1 + (1 + 2) + (1 + 2 + 3) +... + (1 + 2 +... + 100)
*/
Void addAdd (){
Int sum = 0;
For (int I = 1; I <= 100; I ++ ){
Int tempSum = 0;
For (int j = 1; j <= I; j ++ ){
TempSum + = j;
}
Sum + = tempSum;
}
System. out. println (sum );
}
/*
* Request: 1! + 2! + 3! +... + 15!
*/
Void addFactorial (){
Long result = 0;
For (int I = 1; I <= 15; I ++ ){
Int temp = 1;
For (int j = 1; j <= I; j ++ ){
Temp * = j;
}
Result + = temp;
}
System. out. println (result );
}
}