Unique Numbers

import java.io.*;
class Unique
{
public static void main() throws IOException
{
InputStreamReader x= new InputStreamReader(System.in);
BufferedReader y= new BufferedReader(x);

int m,n,temp,r,i,c,flag=0,num,count=0;
System.out.println(“Enter lower and upper limits”);
m=Integer.parseInt(y.readLine());
n=Integer.parseInt(y.readLine());

System.out.println(“Unique Integers are :”);
for(num=m;num<=n;num++)
{
for(i=0;i<=9;i++)
{
temp=num;
c=0;
while(temp>0)
{
r=temp%10;
if(r==i)
c++;

temp=temp/10;
}
if(c>1)
{
flag=1;
break;
}
}
if(flag==0)
{
System.out.println(num);
count++;
}
flag=0;
}
System.out.println(“Frequency of Unique Integers are: “+count);
}
}

Advertisements
Comments
  1. Just Brainstormed by the level and novelty of questions . Great job sir. 😀 Kudos

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s