Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- int main(int argc, char *argv[])
- {
- int pre[10];
- int i, aux1, aux2;
- printf("Digite alguns numeros por favor:\n\n");
- scanf("%d", &pre[i]);
- for (i=0; i<10; i++)
- {
- if(pre[i]!='\0')
- {
- aux1=(i-1);
- aux2=(i-2);
- i=10;
- }
- }
- for (i=0; i<10; i++)
- {
- if ((pre[i]!=0)&&(pre[i]!=1))
- {
- printf("Cadeia de caracteres digitados invalida!\n\n");
- i=10;
- }
- else
- {
- if((pre[aux1]!=1)&&(pre[aux2]!=0))
- {
- printf("Sufixo da cadeia não aceito!");
- }
- else
- {
- printf("Cadeia aceita com sucesso!");
- i=10;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement