mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
Resolve typo errors
This commit is contained in:
parent
877125eb8a
commit
5ee32c63de
@ -12,7 +12,7 @@
|
|||||||
*
|
*
|
||||||
* Example:- N=36
|
* Example:- N=36
|
||||||
* 36 = (3^2 * 2^2)
|
* 36 = (3^2 * 2^2)
|
||||||
* numbe-of-divisors(36) = (2+1) * (2+1) = 9.
|
* number-of-divisors(36) = (2+1) * (2+1) = 9.
|
||||||
* list of divisors of 36 = 1, 2, 3, 4, 6, 9, 12, 18, 36.
|
* list of divisors of 36 = 1, 2, 3, 4, 6, 9, 12, 18, 36.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
@ -30,10 +30,10 @@ int number_of_divisors(int n) {
|
|||||||
}
|
}
|
||||||
int divisors_count = 1;
|
int divisors_count = 1;
|
||||||
// If n is prime at that time vector prime_exponent_count will remain empty.
|
// If n is prime at that time vector prime_exponent_count will remain empty.
|
||||||
for (int i=0; i<prime_exponent_count.size(); i++) {
|
for (int i=0; i < prime_exponent_count.size(); i++) {
|
||||||
divisors_count = divisors_count * (prime_exponent_count[i]+1);
|
divisors_count = divisors_count * (prime_exponent_count[i]+1);
|
||||||
}
|
}
|
||||||
if(divisors_count == 1 and n != 1) {
|
if (divisors_count == 1 && n != 1) {
|
||||||
// Prime number has exactly 2 divisors 1 and itself.
|
// Prime number has exactly 2 divisors 1 and itself.
|
||||||
divisors_count = 2;
|
divisors_count = 2;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user