+ 1
🛑Math.abs(Math.min(-6, 3)); answer-❓❓❓❓❓❓❓❓❓
19 ответов
+ 23
✨Suchismita ✨
min and max are methods in Math class which returns min and max value so here
Math.min(-6, 3) will return -6
Now Math.abs will return absolute value so result will be 6
+ 6
really???
you can't declare variable and then print it out?
If I were your teacher you would get disqualification.
+ 5
Please tag the relevant programming language.
You can test the code snippet on sololearn playground and check out what happens.
+ 5
"why to open the question and waste your time, only to find bs"
✨Suchismita ✨ aren't you the one who posted and open this worst question? he was only answering this one.
+ 3
Instead of scolding ✨Suchismita ✨ , i think u shoùld all explain it like A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ , considering level, it might be hard. May be she is a start-up.
+ 3
Hosein
Are you here to send message only because I don't see yours any activity.
Btw you should wait for 14 more days.
+ 2
Math.min(-6, 3) return -6
Math.abs(-6) return 6
Finally Math.abs(Math.min(-6,3) return 6
+ 1
😐😐😐
Math.min(-6,3)=-6
Math.abs(-6)=6
😐😐😐
+ 1
Math.min (-6,3) will result in -6. The smallest number between -6 and 3 is " -6".
Moving on to the next part, which is Math.Abs(-6). How did we get that -6?? We got that from Math.min(-6,3) above.
Math.abs(-6). How do we do With this abs things?? It will return to positive within the parentheses. So, Math.abs(-6) will result in "6".
Hope this solution helps you ^o^
+ 1
First . Min(-6,3) = -6
Second .math.abs(-6)= 6 is last answer
+ 1
Math.min returns the smallest number which is -6 and math.abs returns the absolute value which is 6.
+ 1
min and max are methods in Math class,
min --> returns minimum value
max --> returns maximum value
abs --> returns absolute value
Now,
Math.abs(Math.min(-6,3))
= Math.abs(-6) # minimum of (-6,3) is -6.
= 6 # absolute value of -6 is 6.
Hence, answer is 6.
+ 1
✨Suchismita ✨ answer: 6
Explanation::
First open the smallest bracket::
i.e.:Math.min(-6,3)
Math.min returns the minimum value that is -6 so value will be -6 then as the smallest bracket is opened now open the other bracket i.e.,Math.abs():
Math.abs returns the absolute value that is -6 will converted to 6...now nothing is more there to solve so final answer is 6..
Hope this anwer is helpful for you...
Happy coding!!☺️
0
The Math.min() function actually returns the least/smallest/minimum number among the numbers passed to it as parameters.
Here, it returns -6, as we can see it is the minimum among the passed numbers (i.e. -6 and 3).
Math.abs() function gives the absolute value of the number passed as an argument. This means, if the passed argument is positive, it will return the same argument back, but if the argument passes is negative, it returns the positive of it. So according to your given sample, it returns 6.
0
Math.abs() will actually return absolute value of an integer... For example,
Math.abs(-5) will return 5.
Math.abs(5) will return 5.
________
And Math.min(a,b); will return the minimum int value..
So ,
Math.min(-6,3) returns -6 and
Math.abs(-6) returns 6..
_--_
0
Math.min(-6, 3) //is -6
Math.abs(-6) //is 6
So the answer is 6
0
public class Program
{
public static void main(String[] args) {
int a = Math.abs(Math.min(-6, 3));
System.out.println(a);
}
}
https://code.sololearn.com/java
0
6