forked from swaaz/basicprograms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram-68.c
More file actions
34 lines (29 loc) · 721 Bytes
/
Copy pathprogram-68.c
File metadata and controls
34 lines (29 loc) · 721 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
#include <stdio.h>
#include <stdlib.h>
int main ()
{
char s[50];
int i, c = 0;
int flag = 0;
printf ("Input a string\n");
scanf ("%s", s);
while (s[c] != '\0')
c++;
for (i = 0; i < c; i++)
{
if(s[i] !='0' && s[i]!='1')
{
printf("error\n");
exit(0);
}
if (s[i] == '0' && s[i + 1] == '0' && s[i + 2] == '0')
{
flag = 1;
}
}
if (flag == 1)
printf ("accepted\n");
else
printf ("not accepted\n");
return 0;
}