Computer Science, asked by kapooralka2015, 3 months ago

Write a program in java to input a number and print its digits in ascending order.​

Answers

Answered by Anonymous
2

Answer:

first) { int tmp = sorted; int to Divide = 1; for (int i = %3D 0; i < sortedDigits; i++) { int tmp Digit = tmp % 10; if (digit >= tmpDigit) { sorted = sorted/ to Divide to Divide+10+ digitto Divide + sorted % toDivide; break; } else if (i == sortedDigits-1) { sorted = digit * digits + sorted;} tmp/= 10; to Divide *= 10; } ...

Answered by atrs7391
1

package My_Program;

import java.util.Scanner;

public class test {

   public static void main(String[] args) {

       Scanner sc = new Scanner(System.in);

       System.out.println("Enter Number: ");

       String s = sc.nextLine();

       char[] numbers = s.toCharArray();

       Arrays.sort(numbers);

       System.out.println(numbers);

   }

}

Similar questions