JAVA PROGRAM TO ENTER A NUMBER CONTAINING THREE DIGITS OR MORE.ARRANGE THE DIGITS OF THE ENTERED NUMBER IN ASCENDING ORDER AND DISPLAY IT\
Answers
Answered by
5
Java Program to Sort the Array in an Ascending Order
public class Ascending _Order.
int n, temp;
Scanner s = new Scanner(System.
System. out. print("Enter no. of elements you want in array:");
n = s. nextInt();
int a[] = new int[n];
System. out. println("Enter all the elements:");
for (int i = 0; i < n; i++)
Answered by
29
Answer:
import java.util.*;
import java.io.*;
class ArrangeDigit
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the Digits to be arranged");
int n=sc.nextInt();
int d,num=n;
for(int i=0;i<n;i++)
{
num=n;
while(num>0)
{
d=num%10;
if(d==i)
{
System.out.print(d);
}
num=num/10;
}
}
System.out.println();
}
}
Explanation:
Similar questions
Computer Science,
6 months ago
Social Sciences,
6 months ago
Math,
6 months ago
English,
11 months ago
India Languages,
11 months ago
Science,
1 year ago
Biology,
1 year ago