My issue
include <stdio.h>
int main() {
// your code goes here
char s1[20];
scanf(“%s”,&s1);
char s;
scanf(“%s”,&s);
for(int i=0;i<=20;i++){
if(s1[i]==s){
printf(“%d”,i);
return 1;
}
}
}
what is the wrong in this code
My code
#include <stdio.h>
int main() {
// your code goes here
char s1[20];
scanf("%s",&s1);
char s;
scanf("%s",&s);
for(int i=0;i<=20;i++){
if(s1[i]==s){
printf("%d",i);
return 1;
}
}
}
Learning course: Data structures and Algorithms
Problem Link: https://www.codechef.com/learn/course/pvp-dsa/PVPDAA13/problems/SESO04