I am writing a program to find the number between 1 and 100 that has the greatest number of distinct divisors. Below is my code for the same. It is returning an erroneous answer, i.e. 8 for greatest number of distinct divisors and 4 as the number for which the greatest divisors are occurring:
Please point out modifications and mistakes. Thank you.
/*program to find a number in the range 1 to 100 that has the largest number of distinct divisors*/
//this loop counts the number of distinct divisors
//result stores the number of distinct divisors, index stores the number for which the greatest distinct divisors have been found
printf("the integer between 0 and 100 with %d number of distinct divisors is %d",result,index);