Nisha Patel
Summary
Let’s assume:
Two parameters- ‘a’, ‘b’
Private Function- getPoints
Public function- sumofPowers
Solution
Explanation
The function getPoints(int num) determines how many prime factors there are for a given integer num.
The function iterates through potential divisors (i) using a loop, determining whether they divide num. For every divisor found, a points counter is increased.
The sum of the prime factors for each number in the range [a, b] is determined by the public member function sumOfPowers(int a, int b).
To determine the prime factor to count for each number, it calls the private function getPoints(i) after iterating through each number in the range.
Suggested blogs:
>Find the number of pairs of elements whose sum is equal to K using C++
>How to check whether string is palindrome or not using C++
>How to determine the smallest possible size of a vertex cover using C++
>Build an Electron application from scratch
>Building Web API using ASP.NET (C#)
>Built Web API using ASP.NET (C#)