| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 12938 | Max/Min Integer |
|
| 12939 | Prime Factorization |
|
Description
- Write a program that asks the user to input an arbitrary number of positive integers terminated by the sentinel ‘-1’.
- Your program output the largest and the smallest integer among them.
- You do not need to handle input exceptions (e.g., negative numbers, characters, … etc )
Input
- A list of numbers, belonging to the set N, such that 0 < N ⩽ 2147483647.
- The last number should be -1.
Output
- Two integers delimited by a whitespace character, with a trailing '\n' character.
- The first integer being the maximum integer, the second integer being the minimum integer.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Write a program that list all prime factors (not including 1) of a given integer n.
The user should input a positive number n.
Let’s say the user inputs 228.
Step 1: Start by dividing the number by the first prime number 2 and continue dividing by 2 until you get a decimal or remainder. Then divide by 3, 5, 7, etc. until the only numbers left are prime numbers.
Step 2: Write the number as a product of prime numbers.
The all prime factors should be the following:

228 = 2*2*3*19
Therefore, the result should be: 2 2 3 19
Input
N, such that, N ∈ +ℤ
Output
All prime factors (not including 1)
After your list of numbers, there should be a single whitespace character.
At the end of your program, add an additional printf("\n")
For example:
2 2 3
\n