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>
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}")
a=[] while True: i=int(input("n:")) if i==0: break else: a.append(i) a.sort(reverse=True) print(a)
Submitting answers is currently unavailable.
Write a program that receives a rectangular length and width from the input and prints its area in the output
Write a program that receives text from the input and prints the translation in the output. It can also be able to get English text from the entrance and convert it to a coder. Input: hooshang ....--- .... ...
Write a program where the user can enter the clock, minutes and seconds as the example below and from the time entered, the countdown to zero is Input: 1:22:50 # One hour and twenty minutes and fifty seconds
برای استفاده از این بخش باید وارد حساب کاربریت بشی
ورود/ثبت نام 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.