Write a program in Java to enter number containing three digits or more arrange the digits of the entered number in ascending order and display the result. sample input:- enter number = 4972 sample output:- the arrange digits are = 2,4,7,9
Answers
Answered by
14
Answer:
Code is being provided below
Explanation:
import java.util.*;
class numbers {
public static void main(String [] args)
{
Num n= new Number() ;
n.input () ;
n.Num() ;
}
}
class Num{
int y, m, s,x;
Scanner sc= new scanner (System.in) ;
System.out.print("Enter the no") ;
x=nextInt();
}
void num(){
while (x!=0)
{
s=x%10;
x=x/10;
m++;
void arr(s, m) ;
}
}
void arr(int k,int l)
{
for(int i=0;i<l;i++)
for(int j;j<i;i++)
{
arr[i]=k;
min=arr[0];
if(arr[i]>arr[j])
{
int tmp=arr[i];
arr[i]=arr[j]
arr[j]=tmp;
}
system.out.print(arr[i]);
}
}
Similar questions
Social Sciences,
6 months ago
Biology,
6 months ago
World Languages,
6 months ago
Math,
1 year ago
English,
1 year ago
Math,
1 year ago
Physics,
1 year ago