How to write a program to find a number having maximum divisors ,in given range? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to write a program to find a number having maximum divisors ,in given range?

m

21st Nov 2017, 2:29 PM
Maria Waheed
Maria Waheed - avatar
3 Answers
+ 1
If I understood you correctly, you want to find the divisors of a number that fall in a certain range. Although I think optimizations can be made, you could just loop in the range with a cycle and test if the division remainder is zero with the current divisor. I wrote a code doing this, hope it helps. (You didn't specify in which language you want to achieve this, so I chose C++. Edit: I see your other codes are in C++ as well, so it was a good choice. :D) https://code.sololearn.com/cJxd646D2Q5v/?ref=app
24th Nov 2017, 3:13 AM
OWRhcmFidQ==
0
yes i was wanted C++ code.thanks for your help
24th Nov 2017, 10:49 AM
Maria Waheed
Maria Waheed - avatar
0
this code has given me more than one number.but i want only one number in range which has maximum divisors
24th Nov 2017, 10:52 AM
Maria Waheed
Maria Waheed - avatar