50道javaSE练习题(国外英文资料).docVIP

  • 8
  • 0
  • 约1.5万字
  • 约 18页
  • 2017-06-05 发布于河南
  • 举报
50道javaSE练习题(国外英文资料)

50道javaSE练习题 【 application 】 Topic: classical problem: there is a pair of rabbits, every month since 3 months after birth was born a pair of rabbits, baby bunny to 3 months after birth to a pair of rabbits each month, if the rabbit is dead, What is the total number of rabbits per month? Program analysis: the rabbits rule is 1, 1, 2, 3, 5, 8, 13, 21... 【 program 2 】 Problem: determine how many prime Numbers are between 101-200 and output all prime Numbers. Program analysis: the method of determining prime Numbers: removing 2 to SQRT (this number) by a number, if it can be divisible, It shows that this number is not a prime number, but a prime number. 【 program 3 】 Topic: print out all the daffodil number, the so-called narcissi few refers to a three digits, the digits cubic and is equal to the number itself. For example: 153 is a daffodil number, Because 153 is equal to 1 to the third plus 5 to the third plus 3 to the third. Program analysis: using the for loop to control 100-999 Numbers, each number is decomposed into individual bits, tens, and hundreds. 【 procedure 4 】 Problem: the decomposition of a positive integer. For example: enter 90, print 90 = 2 * 3 * 3 * 5. To decompose the prime factorization of n, find the smallest prime number k, and then follow the steps below: (1) if this prime number is equal to n, the process of decomposing the prime factorization is over and printed out. (2) if n k, but n can be divisible by k, you should print out the value of k and use n over ks quotient, as the new positive integer you n, repeat the first step. (3) if n cannot be divisible by k, then the first step is repeated with k + 1 as the value of k. 5 】 【 program Topic: use conditional operator nesting to complete this topic: = 90 grades of students with A said that between 60 to 89 points in B, below 60 points in C said. Program analysis: (a b). A: b this is a basic example of conditional operators. The program 6 】 Problem: input two positive integers m and n, and fi

文档评论(0)

1亿VIP精品文档

相关文档