The simple (brute-force) way to do it would be something like this:
For every integer i from 2 to n-1 do:
If n modulo i equals 0, output i.
This would be very slow for large n (linear in the size of n, in the best case).
yea me too dude. Mahleko :(
Having an unsigned integer means that the integer is positive, and not negative; literally, the integer is unsigned and assumed to be positive. The unsigned integer 8 is positive-eight, not negative-eight.
Store the absolute value of the desired integer in a variable. Multiply the absolute value by two. Substract the new integer by the old integer.
An integer is a whole number that can be positive, negative, or zero. In this case, the integer representation of 25 is simply 25. It is a positive whole number that is greater than zero and does not have any fractional or decimal parts.
signed integer means that it has a sigh (+ or -). Using another words you say that signed variable can be positive as well as negative. unsigned variables can be only positive.
design an algorithm for finding all the factors of a positive integer
A prime number is a number with two positive integer factors, while a composite number has more than two positive integer factors. Since the number 0 has no positive integer factors, and the number 1 has just one positive integer factor (itself), neither of these are prime.
The positive integer factors of 18 are: 1 2 3 6 9 18 The positive integer factors of 7 are: 1 7 Since 7 is a prime number, the only positive integer common factors of the two numbers is the number 1.
The positive integer factors of 1941 are: 1, 3, 647, 1941 The prime factors are 3 and 647.
The positive integer factors of 311 are: 1, 311
The positive integer factors of 233 are: 1, 233
The positive integer factors of 463 are: 1, 463
The positive integer factors of 1319 are: 1, 1319
The positive integer factors of 421 are: 1, 421
The positive integer factors of 1997 are: 1, 1997
The positive integer factors of 167 are: 1, 167
The positive integer factors of 151 are: 1, 151