Home > Back-end >  Ask bosses
Ask bosses

Time:09-19

Enter a positive integer n, the output between 90 ~ 99 and the n the largest of the least common multiple of the Numbers and the common multiple, such as: input 6, the output 97 582, how do you get this in circulation structure??

CodePudding user response:

1. Define a judgment function of the least common multiple
2. The cycle to judge from 90 ~ 99, n and several of the least common multiple of
3. The two variables, one to save the current number, save the current number of the least common multiple of
The least common multiple of 4. If the cycle is bigger than the least common multiple of 3, of two variables, update 3
5. End of the cycle, the output variables of 3 is the results you want
  • Related