Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class sepsort {
- public static void main(String args[])
- {
- Scanner src=new Scanner(System.in);
- System.out.println("Enter the number");
- int a=src.nextInt();
- int b=a;
- int n,sum=0;
- while(a>0)
- {
- n=a%10;
- //System.out.println(n);
- a=a/10;
- sum++;
- }
- int[] arr=new int[sum];
- int i =0;
- while(b>0)
- {
- int n1=b%10;
- arr[i]=n1;
- //System.out.println(n1);
- b=b/10;
- i++;
- }
- /*for(int j=0;j<sum;j++)
- {
- System.out.println(arr[j]);
- }*/
- int m=arr.length;
- int[] arr2=new int[m];
- int p=m-1;
- for(int q=0;q<sum;q++)
- {
- arr2[p]=arr[q];
- p--;
- }
- for(int t=0;t<sum;t++)
- {
- System.out.println("The digit at position "+t+" is "+arr2[t]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement