You can also use the Collections.sort() method to sort values in an array list. You can also use the Comparable Interface or Comparators for providing custom implementations of sorting algorithms for values inside an ArrayList.
Chat with our AI personalities
You use the relevant formula.
first finding the whole number and then sort them out from least to greatest in answers
You could always sort them, putting lesser numbers higher, until you have them all sorted. Then the least number would be at the top. Or you could subtract from all of them until one becomes zero. That would be the least.
DIM nums(10) CLS FOR i = 0 TO 9 nums(i) = (RND * 10) + 1 PRINT nums(i) NEXT PRINT : PRINT "Press Enter to sort numbers" rem pause to look at numbers DO WHILE INKEY$ = "": LOOP CLS FOR loop1 = 0 TO 9 FOR loop2 = loop1 + 1 TO 9 IF nums(loop1) > nums(loop2) THEN SWAP nums(loop1), nums(loop2) NEXT NEXT FOR i = 0 TO 9: PRINT nums(i): NEXT
The Fibonacci numbers is a series of numbers that are found in nature and other things. The series goes 0,1,1,2,3,5,8,13,21 and so on. You just add the last two numbers in the series. 0+1=1, 1+1=2, 2+1=3, and so on.