-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathg.c
More file actions
59 lines (50 loc) · 869 Bytes
/
g.c
File metadata and controls
59 lines (50 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// #include <stdio.h>
// #include <string.h>
// int main()
// {
// char a[2000]={0};
// int count=0;
// int frezz=0;
// char n;
// scanf("%ch",&n);
// getchar();
// gets(a);
// for (int i = 0; i < strlen(a); i++)
// {
// /* code */
// if(a[i]==n)
// count = i;
// frezz =1;
// }
// if(frezz)
// printf("index = %d",count);
// else
// {
// printf("Not Found");
// }
// return 0;
// }
#include <stdio.h>
int main()
{
int i, index, count;
char a, ch, str[80];
scanf("%c\n", &a);
i=0;
index=-1;
count=0;
ch=getchar();
for(i=0; ch!='\n'; i++){
str[i]=ch;
count++;
ch=getchar();
}
for(i=0; i<count; i++)
if(a==str[i])
index=i;
if(index!=-1)
printf("index = %d", index);
else
printf("Not Found");
return 0;
}