forked from sdsubhajitdas/Compiler-Design-Assignment
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path13.c
34 lines (31 loc) · 723 Bytes
/
13.c
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
#include<stdio.h>
int main()
{
char str[80], search[7]={'M','o','n','d','a','y','\0'};
int count1 = 0, count2 = 0, i, j, flag;
printf("Enter a string:");
gets(str);
while (str[count1] != '\0')
count1++;
while (search[count2] != '\0')
count2++;
for (i = 0; i <= count1 - count2; i++)
{
for (j = i; j < i + count2; j++)
{
flag = 1;
if (str[j] != search[j - i])
{
flag = 0;
break;
}
}
if (flag == 1)
break;
}
if (flag == 1)
printf("String Contains Monday");
else
printf("String doesnt Contains Monday");
return 0;
}