"program to find the largest prime factor of a number" Code Answer's
You're definitely familiar with the best coding language Whatever that developers use to develop their projects and they get all their queries like "program to find the largest prime factor of a number" answered properly. Developers are finding an appropriate answer about program to find the largest prime factor of a number related to the Whatever coding language. By visiting this online portal developers get answers concerning Whatever codes question like program to find the largest prime factor of a number. Enter your desired code related query in the search bar and get every piece of information about Whatever code related question on program to find the largest prime factor of a number.
program to find the largest prime factor of a number
## to find the greatest factor of “A” in the the range up to “B”
1. #include<iostream>
2. #include<algorithm>
3. #include<math.h>
4. using namespace std;
5. int main()
6. {
7. int T;
8. cin>>T;
9. while(T--)
10. {
11. int A,B;
12. cin>>A>>B;
13. int mn=A;
14. for(int i=1;i<=sqrt(A);i++)
15. {
16. if(A%i==0)
17. {
18. if(i<=B)
19. {
20. mn=min(mn,A/i);
21. }
22. if(A/i<=B)
23. {
24. mn=min(mn,i);
25. }
26. }
27. }
28. cout<<mn<<endl;
29. }
30. return 0;
31. }
use the Sieve of Eratosthenes
All those coders who are working on the Whatever based application and are stuck on program to find the largest prime factor of a number can get a collection of related answers to their query. Programmers need to enter their query on program to find the largest prime factor of a number related to Whatever code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about program to find the largest prime factor of a number for the programmers working on Whatever code while coding their module. Coders are also allowed to rectify already present answers of program to find the largest prime factor of a number while working on the Whatever language code. Developers can add up suggestions if they deem fit any other answer relating to "program to find the largest prime factor of a number". Visit this developer's friendly online web community, CodeProZone, and get your queries like program to find the largest prime factor of a number resolved professionally and stay updated to the latest Whatever updates.