You are viewing a single comment's thread. Return to all comments →
put that i++ outside of if condition.
int sum=0; int i=1; while(i<=n) { if(n%i==0) { sum+=i; } i++; }
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 →
put that i++ outside of if condition.
int sum=0; int i=1; while(i<=n) { if(n%i==0) { sum+=i; } i++; }