In: Computer Science
write the dfa for Let L={w in {0,1}*| w is a binary number that is a multiple of 4}
// I HOPE I COULD HELP
// IN CASE OF ANY QUERY FEEL FREE TO COMMENT AND ASK
final state=q0
non-final state=q1,q2,q3
The state transition diagram drawn below will accept all strings over {0,1} which when interpreted are multiples of 4.
On testing on the inputs 0 it will get accepted as it is a multiple of 4, 01 will not be accepted by the dfa, 10 will leave remainder as 2 hence again not accepted, 11 will leave remainder as 3 hence not accepted and will end on q3, 100 will be accepted by the dfa at state q0 as it is a multiple of 4.