From 24a04ad7b528e4823246c322b2b50eb31560b428 Mon Sep 17 00:00:00 2001 From: Mohamed A Hameed Date: Mon, 13 Jun 2022 11:28:24 +0300 Subject: [PATCH 1/7] Update index.js --- src/index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index db5807b..58cb1c6 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,19 @@ // complete the function function prime (num) { - // code goes here + let temp = 0; +for (let i = 2; i <= num / 2; i++) { + // check if num is divisible by any number. + if (num % i == 0) { + temp++; + } +} + +// check for the value of temp and num. + +return temp && num != 1 + ? console.log(`${num} is prime`) + : console.log(`${num} is not prime`); + } function solution (arg) { From e7299dbd5e0015b186e4b922ca8c8be832efd825 Mon Sep 17 00:00:00 2001 From: Mohamed A Hameed Date: Mon, 13 Jun 2022 11:35:47 +0300 Subject: [PATCH 2/7] Update index.js --- src/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index 58cb1c6..94490e7 100644 --- a/src/index.js +++ b/src/index.js @@ -10,10 +10,10 @@ for (let i = 2; i <= num / 2; i++) { // check for the value of temp and num. -return temp && num != 1 - ? console.log(`${num} is prime`) - : console.log(`${num} is not prime`); - +// return temp && num != 1 +// ? console.log(`${num} is prime`) +// : console.log(`${num} is not prime`); +return "hi" } function solution (arg) { From 52c935125627fae0448afebf650b84b15e834138 Mon Sep 17 00:00:00 2001 From: Mohamed A Hameed Date: Mon, 13 Jun 2022 11:36:51 +0300 Subject: [PATCH 3/7] Update index.js --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 94490e7..4285c80 100644 --- a/src/index.js +++ b/src/index.js @@ -13,7 +13,7 @@ for (let i = 2; i <= num / 2; i++) { // return temp && num != 1 // ? console.log(`${num} is prime`) // : console.log(`${num} is not prime`); -return "hi" +return console.log("hi") } function solution (arg) { From 1a104d940f7cf2878fec2f5a4c3bf6106eb44d6a Mon Sep 17 00:00:00 2001 From: Mohamed A Hameed Date: Mon, 13 Jun 2022 11:37:56 +0300 Subject: [PATCH 4/7] Update index.js --- src/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/index.js b/src/index.js index 4285c80..6d1debd 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,7 @@ // complete the function function prime (num) { + + console.log("hi") let temp = 0; for (let i = 2; i <= num / 2; i++) { // check if num is divisible by any number. From 212227fdec6fad19b9c88c32ab924257f3f16c7c Mon Sep 17 00:00:00 2001 From: Mohamed A Hameed Date: Mon, 13 Jun 2022 11:42:59 +0300 Subject: [PATCH 5/7] Update index.js --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 6d1debd..a894fb4 100644 --- a/src/index.js +++ b/src/index.js @@ -1,7 +1,7 @@ // complete the function function prime (num) { - console.log("hi") + console.log("hi 1") let temp = 0; for (let i = 2; i <= num / 2; i++) { // check if num is divisible by any number. @@ -15,7 +15,7 @@ for (let i = 2; i <= num / 2; i++) { // return temp && num != 1 // ? console.log(`${num} is prime`) // : console.log(`${num} is not prime`); -return console.log("hi") +return console.log("hi 2") } function solution (arg) { From ea4c183cd8c2e9b4d7442c5e59d4ff1090637cc0 Mon Sep 17 00:00:00 2001 From: Mohamed A Hameed Date: Mon, 13 Jun 2022 11:46:22 +0300 Subject: [PATCH 6/7] Update index.js --- src/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index a894fb4..bdc65c2 100644 --- a/src/index.js +++ b/src/index.js @@ -12,10 +12,10 @@ for (let i = 2; i <= num / 2; i++) { // check for the value of temp and num. -// return temp && num != 1 -// ? console.log(`${num} is prime`) -// : console.log(`${num} is not prime`); -return console.log("hi 2") +return temp && num != 1 + ? console.log(`${num} is prime`) + : console.log(`${num} is not prime`); + } function solution (arg) { From f2b5eb5fb69468056f1c6a9fe93e5432ca73ab9c Mon Sep 17 00:00:00 2001 From: Mohamed A Hameed Date: Mon, 13 Jun 2022 11:47:06 +0300 Subject: [PATCH 7/7] Update index.js --- src/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index bdc65c2..c3a7bc1 100644 --- a/src/index.js +++ b/src/index.js @@ -1,8 +1,7 @@ // complete the function function prime (num) { - console.log("hi 1") - let temp = 0; + let temp = 0; for (let i = 2; i <= num / 2; i++) { // check if num is divisible by any number. if (num % i == 0) {