Create DFA for all the String Combination of 0&1 which doesn’t allow Substring 001


#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
          char str[50];
          int i,len,flag;
          clrscr();
          printf("\n Enter the String:-");
          gets(str);
          len=strlen(str)-1;
          for(i=0;i<len;i++)
          {
                   if(str[i]=='0' && str[i+1]=='0' && str[i+2]=='1')
                             flag=1;
          }
          if(flag==1)
                   printf("\n INValidddd.....");
          else
                   printf("\n Valid String");
  getch();
}

Read more...

Create DFA for all the String Combination of 0&1 which doesn’t allow Substring 110


#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
          char str[50];
          int i,len,flag;
          clrscr();
          printf("\n Enter the String:-");
          gets(str);
          len=strlen(str)-1;
          for(i=0;i<len;i++)
          {
                   if(str[i]=='1' && str[i+1]=='1' && str[i+2]=='0')
                             flag=1;
          }
          if(flag==1)
                   printf("\n INValidddd.....");
          else
                   printf("\n Valid String");
  getch();
}

Read more...

Write a C program to verify the string 0(0|1)*0 | 1(0|1)*0


#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
          char str[20];
          int i,len;
          clrscr();
          printf("\n Enter the String:-");
          gets(str);
          len=strlen(str)-1;
          if((str[0]=='0' && str[len]=='0')) printf("\n Validddd.....");
          else if(str[0]=='1' && str[len]=='0')
                   printf("\n Validddd.....");
          else
                   printf("\n INValid String");
  getch();}

Read more...

Write a C program to verify the String (a|b)*abb


#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
          int len,i;
          char str[50];
          clrscr();
          printf("\nEnter the String:-\n");
          gets(str);
          len=strlen(str)-1;
          if(str[len-2]=='a'&& str[len-1]=='b'&& str[len]=='b')
                   printf("Valid");
          else
                   printf("Invalid");
          getch();
}

Read more...

Write a C program to verify the String 0(0|1)*1


#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
          char str[20];
          int i,len;
          clrscr();
          printf("\n Enter the String:-");
          gets(str);
          len=strlen(str)-1;
          if((str[0]=='0' && str[len]=='1'))
                   printf("\n Validddd.....");
          else
                   printf("\n INValid String");
  getch();
}

Read more...
Related Posts Plugin for WordPress, Blogger...

Engineering material

GTU IDP/ UDP PROJECT

GTU IDP/ UDP PROJECT

Patel free software download

  © Blogger templates The Professional Template by Ourblogtemplates.com 2008

Back to TOP