Computer Science, asked by lily978, 1 year ago

wap in java to input a number from the user and arrrange the digits of number in ascending order

Answers

Answered by nitish8089
4
import java.util.Arrays;

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

public calss Ascending{

public static void main(String...args) throws IOException {

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

String str=br.readLine();

char[] store=str.toCharArray();

Arrays.sort(store);

for(char x:store){

System.out.print(x);

}

}

}

lily978: Do u know how to make it from string ?
nitish8089: it's already by string...
nitish8089: another method..
nitish8089: use any sorting algorithm
nitish8089: and acess the string element by charAt() method...
Similar questions