Copy this code in Java . Hope it helps you to understan Math.rint and round and other funtions public class ALL { public static void main(String args[]) { double i; System.out.println("_________________________________________________________"); System.out.println("| Number" + "\t" + "| abs " + "\t" + "| rint" + "\t" + "| round" + "\t" +"| sqrt "); System.out.println("_________________________________________________________"); for(i = -2.0 ; i< 5 ; ) { System.out.println("| "+i+" " + "\t" + "| " + Math.abs(i) + " " + "\t" + "| " + Math.rint(i) + " " + "\t" + "| " + Math.round(i)+ " " + "\t" + "| " + Math.sqrt(i)); i = i+0.5; } } } |
|
asked by Ansh Anand (teleansh) 5 years ago | |
1 |
Can we use escape sequence for new line feed or Do i have to go the old school way? |
|
asked by Isha Choudhury (dessicatedcoconut) 5 years ago | |
3 |
Guys Is call by reference prog there in syllabus?? |
|
asked by SId m (siddhant03) 5 years ago | |
3 |
Are rectangular patters in syllabus? |
|
asked by Aswin Krishnan (aswink2004) 5 years ago | |
2 |
az BY cx till a reaches to z and z reaches to a |
|
asked by Bitthal Maheshwari (bitthal04) 5 years ago | |
3 | |
Does anyone have output related or bit hard unpredictable outputs putting multiple concepts to test-like paper links? Would be appreciated by me making an account to sub to TSeries! XD |
|
asked by Aryan Gupta (xprince) 5 years ago | |
4 |
for reversing a String, can we use the .reverse(); function or do we have to do it using the for loop? |
|
asked by Pep Sarri (pepsarri) 5 years ago | |
2 |
Is it compulsory to use scanner class cuz our school said no to buffer clss |
|
asked by Tubhyam Mehta (tirth7683) 5 years ago | |
4 | |
This is for those struggling for Math.rint(), hope this helps.. How Math.rint() works: EVEN NUMBER CASES: (1) Math.rint(4.4) = 4.0 [This is basically just like math.round it will round to lowest] (2) Math.rint(4.5) = 4.0 [Since, the number main decimal number (4) is an even number, instead of rounding of to higher number like 5.0 from decimal point 0.5 it will round of to 4.0, unlike .round function] [For such no. if u want to round it to 5.0, the decimal shud be 0.6 or greater, like the case below] ODD NUMBER CASES: (3) Math.rint(4.6/4.7 or greater) = 5.0 Now for the bottom 3 examples, the main decimal number (3) is an odd no, so it will obey standard rules of rounding, i.e. rounding will start from the 0.5 itself] Exactly like Math.round() function.. except round returns int type.. (4) Math.rint(3.4) = 3.0 (5) Math.rint(3.5) = 4.0 (6) Math.rint(3.6/3.7 or greater) = 4.0 *Negative numbers are the same.. just ignore the minus sign and follow above procedure, then put the minus sign back in the answer |
|
asked by Sahaj Shah (eternityseeker) 5 years ago | |
4 |
Difference between boxing and unboxing???? (Not given in my textbook at all) |
|
asked by Harjas Bajaj (jammy229) 5 years ago | |
1 |
Page 55 |
ICSE chat