#`I need help with coming up a code

23 messages · Page 1 of 1 (latest)

stark adder
#

What have you done so far?

worldly sierra
#

Wait I will show u

#

var addpositive = function(number) {
var number = parseInt(prompt("Enter a number greater than 1"))
var add = []
while (number > 1) {
for (var i = 1; i < number; i++) {
var num = number - i
add.push("(" + i + ", " + num + ")")
}
console.log ("The additive combinations are " + add + ".");
var number = parseInt(prompt("Enter a number greater than 1"))
var add = []
}
if (number < 2) {
console.log("Goodbye!")
}
}
addpositive()

#

I just need help with changing the code into short

stark adder
#

Into short?

worldly sierra
#

Yes and simpler

stark adder
#

I mean it seems good enough why do you want to shorten it?

#

Shorter code != Better code

#

Also use codeblocks

#

!code

ionic daggerBOT
#
Code Formatting

When sharing code with the community, please use the correct formatting for ease of readability.

Example

```py
YOUR CODE HERE
```

Those are back ticks not single quotes, typically the key above TAB

worldly sierra
#

Cuz someone in my class has the same code so I need help changing it

stark adder
#

Did you copy this code?

#

Well you could change var to let

#

That is generally a better practice

#

And could do function addPositive(number) {} if you really wanted to

worldly sierra
#

Can u help me re write it just a bit so the loop is also different I need to submit this asap

stark adder
#

I can't help with something that seems like academic dishonesty

#

!rule honesty

ionic daggerBOT
#
Academic Honesty

We will help you understand your homework, we will help you figure out the solution, we will not give you the answers. For tests and quizzes we can help you with your studying, we can only give you vague nudges in the right direction on quizzes, we will not help with tests.

worldly sierra
#

It is my own work

#

I just need help with changing the outcome

#

Someone copy pasted my work and send my work to the teacher and my teacher is telling me ge my work cuz he thinks I copied bruh