My issue
include <stdio.h>
int is_lucky(int B, int count) {
if (B < count) {
return 1;
}
if (B % count == 0) {
return 0;
}
return is_lucky(B - (B / count), count + 1);
}
int main() {
int B;
scanf(“%d”, &B);
if (is_lucky(B, 2)) {
printf(“Lucky”);
} else {
printf(“Not Lucky”);
}
return 0;
}
this is the code what is the eeror in that
My code
#include <stdio.h>
int is_lucky(int B, int count) {
if (B < count) {
return 1;
}
if (B % count == 0) {
return 0;
}
return is_lucky(B - (B / count), count + 1);
}
int main() {
int B;
scanf("%d", &B);
if (is_lucky(B, 2)) {
printf("Lucky");
} else {
printf("Not Lucky");
}
return 0;
}
Learning course: Algorithmic Problem Solving
Problem Link: https://www.codechef.com/learn/course/klu-problem-solving/KLUPS00A/problems/LPYAS155