1. Rabbit issue (Fibonacci series)
Public class Fibonacci {
Public static void main (string [] ARGs ){
System. Out. println ("the RABIT of 1th month: 1 ");
System. Out. println ("the RABIT of 2th month: 2 ");
Int F1 = 1, f2 = 1, F, M = 24;
For (INT I = 3; I <= m; I ++ ){
F = F2;
F2 = F1 + F2;
F1 = F;
System. Out. println ("the" + I + "th" + "month's RABIT is" + F2 );
}
}
}
2. Calculate the prime number between 100 and 201:
Public class primenum {
Public static void main (string [] ARGs ){
Int COUNT = 0;
For (INT I = 101; I <200; I + = 2 ){
Boolean B = false;
For (Int J = 2; j <= math. SQRT (I); j ++ ){
If (I % J = 0 ){
B = false;
Break;
} Else {
B = true;
}
}
If (B = true ){
Count ++;
System. Out. println ("the prime number is" + I );
}
}
System. Out. println ("the number of prime number is" + count );
}
}
3. Daffodils (narcissism ):
Public class narcissisticnum {
Public static void main (string [] ARGs ){
Int m, n, l;
For (int K = 101; k <1000; k ++ ){
M = K/100;
N = kb % 100/10;
L = K % 10;
If (M * m + n * n + L * l) = k ){
System. Out. println (K + "is so narcissitic !!! ");
}
}
}
}
4. decomposition prime factor:
Import java. util. collections;
Public class decompositionofthequalityfactor {
Public static void main (string [] ARGs ){
Required bytes = new bytes (system. In );
System. Out. println ("Please input a int number :");
Int n = response. nextint ();
Int K = 2;
System. Out. Print (n + "= ");
While (k <= N ){
If (k = N ){
System. Out. Print (N );
Break;
} Else if (N % K = 0 ){
System. Out. Print (K + "*");
N = N/K;
} Else {
K ++;
}
}
}
}
5. Score level judgment:
Import java. util. collections;
Public class scoregrade {
Public static void main (string [] ARGs ){
Int X;
Char grade;
Required bytes = new bytes (system. In );
System. Out. println ("Please input a score :");
X = response. nextint ();
Grade = x> = 90? 'A': x> = 60? 'B': 'C ';
System. Out. println ("the grade is:" + grade );
}
}
Question 1-5