Sorting numbers from large to small
Write a program that receives an infinite number from the user and when the user entered the number 0; Print all numbers entered from large to small in the output
Write a program that receives an infinite number from the user and when the user entered the number 0; Print all numbers entered from large to small in the output
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
numbers=[] while True: num=int(input("enter number")) numbers.append(num) if num==0: break numbers.sort() print(numbers)
a=[ ] namber = int (input("adad:")) for i in namber : if namber >0 : namber.append(a) a.sort(revats=true) print (a)
package org.example fun main() { val list1 = mutableListOf<Int>() while(true){ try { println("Please Enter One Number except Zero") println("Enter : [0]-> Program is Closed") println("then the numbers are sorted from big to small") val number = readlnOrNull()?.toInt()!! list1.add(number) list1.sortDescending() list1.remove(0) when(number) { 0 -> { println("##### Program is Closed #######") list1.forEach { print(" $it ") } break } else ->{continue} } }catch(e:Exception){ println(e.message) } } }
l = [] def chap(): global a while True: a = int(input("number:")) if a == 0: l.sort() l.reverse() return l elif not a == 0: l.append(a) print(chap())
<input type="text" id="myInput"> <button onclick="getValue()">Get Value</button> <script> let array = []; function getValue() { var input = document.getElementById("myInput"); var value = input.value; array.push(value); array.sort((a, b) => b - a); if(value == 0){ alert('end'); console.log(array); return } ; input.value = ' ' } </script>
numbers = []
while True:
number = int(input('Enter number (0=close) : '))
if number == 0:
break
else:
numbers.append(number)
numbers.sort()
numbers.reverse()
print(*numbers)
List1 = [] List2 = [] while 1: Num = float(input("Give me a number:")) List1.append(Num) if Num == 0: break print(List1) while 1: Num1 = max(*[List1]) List2.append(Num1) List1.remove(Num1) if List1 == []: break print(f"The sort of numbers MAX to MIN is:{List2}")
Submitting answers is currently unavailable.
Write a function that receives the number of hours of employee work per month as a parameter and calculates the amount of employee salaries according to the formula below and returns each employee for 2 hours of work per month, per hour at 4 ...
Create a link with the following details by clicking the user link to be directly calling 090000000.
Write a function that receives a list of numbers and generates 2 lists for pair and individual numbers and prints in the output example ([1,2,3,4]) Output: [1,3] [2,4] [2,4]
برای استفاده از این بخش باید وارد حساب کاربریت بشی
ورود/ثبت نام If you don’t understand the exercise or can’t solve it for any reason, that’s completely
normal—don’t worry 😊
Try checking out easier exercises and reviewing different answers
submitted by others. Gradually, you can move on to more challenging exercises. Also, your answer
might be correct even if it’s different from others.