23 Replies
⌛
This post has been reserved for your question.
Hey @blue! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
if a is >10, abs() turns the result into a positive number
similar with b
abs(10-a) calculates how much
a
is away from 10
if it wasn't there, it would just prefer the highest number no matter whatI wrote that part of the code from the exercise but abs was given therefore my question but the number just stays the same if it is negative it will return that number and if it is positiv it will return a positive number does abs really change anything
@dan1st | Daniel
if a number is negative, it returns the positive version
e.g. abs(-5) is 5
but shouldn`t it be return a if that was true it is -a in the code though that confuses me
-(-5)
is 5, right?
-a
changes the signaaahhh
hhaha
so if it's a negative number, the sign is changed to be positive
thanks a bunch got totallly confused there!!
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Coulf I ask you another question if you have time
haha got it thanks just one sec need to copy the code
package de.codegym.task.task04.task0413;
/*
Wochentag
/
import java.io.;
import java.util.Scanner;
This message has been formatted automatically. You can disable this using
/preferences
.I used the Scanner and always got the result I was trying to achieve but with BufferReader I only get the output "Diesen Wochentag gibt es nicht" even if I enter 5
Can´t quite find my fault here