I need a C program to compare 4 numbers. I need it to output YES if any 2 numbers or more are equal, otherwise it should output NO.
For example, if a=1, b=2, c=4, d=4 it should output YES because c and d are same. But if all are different from each other only then program should output NO.
I have tried this method.
It's facing issues with online compilers. Saying 'uninitialized value usage'
if((a!=b) && (a!=c) && (a!=d) && (b!=c) && (b!=d) && (c!=d)
`
Test: #1, time: 30 ms., memory: 0 KB, exit code: 0, checker exit code: 1, verdict: WRONG_ANSWER
Input
1987
Answer
2013
Checker Log
wrong answer Answer contains longer sequence [length = 1], but output contains 0 element
. So I need another one. link : https://codeforces.com/problemset/problem/271/A
#include<stdio.h>
int main()
{
int a, b, c, d, number , i , temp;
scanf("%d",&number);
int k;
number+=1;
for(number;number<9001;number++){
temp=number;
for(i=1;i<5;i++){
if(i==1){
a=temp%10;
temp=temp/10;
}
else if (i==2){
b=temp%10;
temp=temp/10;
}
else if (i==3){
c=temp%10;
temp=temp/10;
}
else if (i==4){
d=temp%10;
temp=temp/10;
}
if((a!=b) && (a!=c) && (a!=d) && (b!=c) && (b!=d) && (c!=d) && (i==4)){
printf("%d",number);
k=0;
break;
}
else{
continue;
}
}
if(k==0){
break;
}
}
}```
[problem link][1]
[1]: https://codeforces.com/problemset/problem/271/A