We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
what is wrong in my code.Iam not get output
public int divisorSum(int n)
{
int sum =0;
int i=0;
while( i<=n)
{
if(n%i==0)
sum=sum+i;
i++;
}
return sum;
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 19: Interfaces
You are viewing a single comment's thread. Return to all comments →
what is wrong in my code.Iam not get output public int divisorSum(int n) { int sum =0; int i=0; while( i<=n) { if(n%i==0) sum=sum+i; i++; } return sum; }