import java.io.Console;
public class DuplicateNumber
{
static public void main(String...alt)
{
Console c=System.console();int flag=0;
String s=c.readLine("Enter a Number : ");
label:
for(int i=0;i<s.length()-1;i++)
{
for(int j=i+1;j<s.length();j++)
{
if(s.charAt(i)==s.charAt(j))
{
flag=1;
break label;
}
}
}
if(flag==1)
System.out.println(s+" is Duplicate Number");
else
System.out.println(s+" is Unique Number");
}
}
public class DuplicateNumber
{
static public void main(String...alt)
{
Console c=System.console();int flag=0;
String s=c.readLine("Enter a Number : ");
label:
for(int i=0;i<s.length()-1;i++)
{
for(int j=i+1;j<s.length();j++)
{
if(s.charAt(i)==s.charAt(j))
{
flag=1;
break label;
}
}
}
if(flag==1)
System.out.println(s+" is Duplicate Number");
else
System.out.println(s+" is Unique Number");
}
}
0 Comment to "WAP to enter a number and check whether the number is duplicate or not "
Post a Comment