Skip to content

Instantly share code, notes, and snippets.

@tonkec
Created December 5, 2016 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonkec/05fd191279a4e9d658a3f04095d7b6bf to your computer and use it in GitHub Desktop.
Save tonkec/05fd191279a4e9d658a3f04095d7b6bf to your computer and use it in GitHub Desktop.
function a(k) {
var k,i,s,j;
for (i=1;i<=k;i++) {
s=0;
console.log("prva##############")
console.log("i je: " + i)
console.log("j je:" +j)
console.log("s je:" +s)
for (j=1;j<i;j++) {
console.log("druga###########################")
console.log("i je: " + i)
console.log("j je:" +j)
console.log("s je:" +s)
if (i%j==0) {
console.log("IF########")
console.log("i je: " + i)
console.log("j je:" +j)
s=s+j
console.log("s je:" +s)
};
}
//console.log(s)
if (i<s) {console.log(i)};
}
return 0;
}
a(12)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment