#i dont know how to make this work

1 messages · Page 1 of 1 (latest)

low ravine
#

please help

median isleBOT
#

<@&987246399047479336> please have a look, thanks.

hallow ingot
low ravine
#

so far i have this

#

but it want me to have 3 out puts

hallow ingot
#

yeah, looks good for the beginning

#

well you should prefer:

int userNum = scnr.nextInt();

on one line instead of splitting it

#

same with divNum

low ravine
#

idk how to get the first result to divide to make second result and thrid

hallow ingot
#

make another variable

low ravine
#

like that

hallow ingot
#

that stores the current number

low ravine
#

like totalNum?

hallow ingot
#

I would call it current or smth

#

you dont even need a third variable

#

you can just rename the userNum to current and use that

low ravine
hallow ingot
#

well you can just reuse current

low ravine
#

oh

hallow ingot
#

like

current = userNum / divNum;
// print
current = current / divNum; // this can be simplified using current /= divNum
// print
...
low ravine
#

where it shows 3 results?

#

in one line

hallow ingot
#

use System.out.print instead of println

low ravine
#

what did i do wrong?

hallow ingot
#

it is important at which point you print

#

as you update the variable over and over again

#

so the first output would be the first result of the division

low ravine
#

im so confused lol

#

sorry

hallow ingot
#

well logically go through the code step by step

#

with the example input 2000 and 2

#
current = userNum / divNum; // current = 1000
// print
current = current / divNum; // current = 500
// print
...
#

so you need to print in between the updates

low ravine
#

and how do i make the result not together?

hallow ingot
#

print a " " in between

#

also you are supposed to print three times instead of twice

low ravine
#

idk what i did wrong

hallow ingot
#

it is asking for a println at the end

low ravine
hallow ingot
#

so use println for the last one

low ravine
#

oh i see

hallow ingot
low ravine
#

thank you so much for your help

#

i really aprreciated it

#

so every end you println?

hallow ingot
#

depends what you want

#

println just adds a \n at the end which puts you to the next line

#

its just for line breaks

low ravine
#

ah i seee

hallow ingot
#

the question asked for it, so you were supposed to add it at the end

low ravine
#

so if you want them together just print but if you want new line println?

hallow ingot
#

yeah

low ravine
#

ok ok

hallow ingot
#

most of the time you are going to use println

low ravine
#

thank you so so much

low ravine
low ravine
#

@hallow ingot

#

do you mind if i ask more question?

hallow ingot
#

yeah, but if its not related to this question then make a new thread preferably

low ravine
#

ok