HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Forums > Discussion of problems > topic:


Problem "Prime Factorization"

There is a contest!

В настоящий момент идёт турнир. Некоторая информация и функции сервера недоступны до его окончания.

imesecanMay.06.2011 at 04:35:15 PM
0Сообщение скрыто

imesecanMay.07.2011 at 10:26:36 PM
1While the number is greater then 1 we continue:
we start a divisor from 2. While the number is divisible by 2 we divide it and show two on the screen.
When it is not divisible by 2, we increment it to 3. and we continue dividing by three, if it's divisible.

if the number is a prime number (like 11), no numbers will divide it and the divisor will always be incremented until the number itself. When the divisor is equal to the number it will be divided. Then, the result will be one and the program will quit.


www.contester.ru