filmov
tv
Check input Number is Unique or not using Java. #Java#Coding#programming #EclipseIDE#UniqueNumber

Показать описание
Do a little correction while You write the code, There was a small Typing Mistake On line Number 24: - count = 0 instead of count=1.
Find the source code below.
public class Unique{
public static void main(String[] args) {
int num,temp1,temp2,rem1,rem2,count=0;
temp1=temp2=num;
while(temp1!=0) {
rem1=temp1%10;;
while(temp2!=0) {
rem2=temp2%10;
if(rem1==rem2) {
count++;
}
temp2=temp2/10;
}
temp1=temp1/10;
}
if(count==0) {
}
else {
}
}
}
Find the source code below.
public class Unique{
public static void main(String[] args) {
int num,temp1,temp2,rem1,rem2,count=0;
temp1=temp2=num;
while(temp1!=0) {
rem1=temp1%10;;
while(temp2!=0) {
rem2=temp2%10;
if(rem1==rem2) {
count++;
}
temp2=temp2/10;
}
temp1=temp1/10;
}
if(count==0) {
}
else {
}
}
}