Computer Science, asked by vaibhav36221, 11 months ago

java program to check unique number in an array and print the unique number​

Answers

Answered by raghaw1
0

Answer:

see get all the formula from someone

Answered by riteshgupta0804
0

Answer:

import java.util.*;

class UniqueNumber

{

   public static void main()

   {

       Scanner sc=new Scanner(System.in);

       System.out.println("Enter a number :");

       int n=sc.nextInt();

       String s= Integer.toString(n);  

       int l=s.length();

       int flag=0,i, j;

       for(i=0;i<l-1;i++)

       {

           for(j=i+1;j<l;j++)

           {

               if(s.charAt(i)==s.charAt(j))

               {

                   flag=1;

                   break;

               }

           }

       }

       if(flag ==0)

       System.out.println(" It is an Unique Number");

       else

       System.out.println(" It is not an Unique Number");

   }

}

Explanation: Hope u get it

Similar questions