Science, asked by anjalishaw, 1 year ago

what is a unique number

Answers

Answered by SamarPratap
6
Another 3-digit number, say, 678 if subtracted from its reverse 876 will also yield the same difference, that is, 198. Thus for any number consisting of 3 consecutive digits, the Unique number U3 is always 198. Similarly for a number consisting of 4 consecutive digits, the Unique number U4 = 3087.
Answered by Anonymous
23

Answer:

The unique number is a number where the digits are not repeated .

Example : 4078 is unique .

6669 is not unique as 6 is repeated .

Explanation:

CODE to check unique number is :

import java.util.*;

class unique_number

{

public void main()

{

Scanner sc=new Scanner(System.in);

System.out.println("Enter a number to check whether it is unique number or not");

int n=sc.nextInt();

int cpy=n;

int d=0;

int c=0;

int flag=0;

for(int i=0;i<=9;i++)

{

n=cpy;

c=0;

while(n>0)

{

d=n%10;                

if(d==i)

{

   c++;

}

n=n/10;

}

if(c>1)

{

flag=1;

break;

}

}

if(flag==0)

{

System.out.println("Unique number");

}

else

{

System.out.println("Not a unique number");

}

}

}

Similar questions