My issue
include <stdio.h>
int main(void) {
// your code goes here
int N,X;
int A[N];
scanf(“%d %d”, &N, &X);
for(int i = 0; i < N; i++){
scanf(“%d”, &A[i]);
}
int temp = 0;
for(int i = 0; i < N; i++){
if(A[i] == X){
temp = 1;
}
}
if(temp==1){
printf("YES");
}
else{
printf("NO");
}
return 0;
}
My code
#include <stdio.h>
int main(void) {
// your code goes here
int N,X;
int A[N];
scanf("%d %d", &N, &X);
for(int i = 0; i < N; i++){
scanf("%d", &A[i]);
}
int temp = 0;
for(int i = 0; i < N; i++){
if(A[i] == X){
temp = 1;
}
}
if(temp==1){
printf("YES");
}
else{
printf("NO");
}
return 0;
}
Learning course: Data structures & Algorithms lab
Problem Link: https://www.codechef.com/learn/course/muj-dsa-c/MUJDSAC06/problems/SEARCHINARR