Professional Documents
Culture Documents
CS 501 TOC Student 'S Lab Manual ODD Experiment 3 & 4 - 1563612393 - 1563622291
CS 501 TOC Student 'S Lab Manual ODD Experiment 3 & 4 - 1563612393 - 1563622291
LAB MANUAL
(CS-501)
V Sem (CSE)
CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE. DEPARTMENT OF COMPUTER SCIENCE & ENGG
THEORY OF COMPUTATION LABORATORY 2
DEPARTMENT OF
Computer Science & Engg
CERTIFICATE
for V Semester of the Computer Science & Engg Department during year 2019 20
Signature of
Faculty In-charge
CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE. DEPARTMENT OF COMPUTER SCIENCE & ENGG
THEORY OF COMPUTATION LABORATORY 3
INDEX
Sl. Expt. Name of the Experiment Date Signature
No. No. of of Faculty-
Condu in-Charge
ction
01. 3 Design a Program for Mode 3 Machine
02. 4 Design a program for accepting decimal number divisible by 2.
CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE. DEPARTMENT OF COMPUTER SCIENCE & ENGG
THEORY OF COMPUTATION LABORATORY 4
Aim: Design a Program for Mode 3 Machine
Theory: Given two numbers ‘num’ and ‘divisor’, find remainder when ‘num’ is divided by ‘divisor’. The use of
modulo or % operator is not allowed.
Examples:
Input: num = 100, divisor = 7
Output: 2
Input: num = 30, divisor = 9
Output: 3
Viva Questions:
1. Define Automata/FSM?
2. What is the application of Finite Automata?
3. Design FSM for Mod 3?
4. What are the characteristics of Automata?
Solution:
CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE. DEPARTMENT OF COMPUTER SCIENCE & ENGG
THEORY OF COMPUTATION LABORATORY 5
Aim: Design a program for accepting decimal number divisible by 2.
Theory: In this program user checks the logic about numeric value that will it be Division able with 5 or not. To
check this declares a variable of integer type. And a logic will be used along with the Modulus operator(%).that
will be manipulate with the numeric value and control statement (if-else) used if the numeric value is dividable
than output will be ok else it will be reverse.
Problem Statement:
This is the program to check whether the Numeric value is division able with 2 or Not.
Enter Numeric value.
Use Logic to manipulate.
Declare if-else Condition.
Displaying output on the Display.
Here is source code of the C program to Check out The Numeric value is Division able with 2 or Not.
Viva Questions:
1. Define string created by using alphabet?
2. How to design the automata to check weather decimal divisible by any number?
3. How the string is accepted by the Automata?
4. Difference between DFA and NDFA?
Solution:
#include<stdio.h>
void main()
{
int a;
clrscr();
printf ("Enter the no.");
scanf("%d",&a);
if(a%5==0)
{
printf("Accept: No.is Divisible by 2");
}
else
{
printf("Reject: No is not Divisible by 2");
}
getch();
}
CHAMELI DEVI GROUP OF INSTITUTIONS, INDORE. DEPARTMENT OF COMPUTER SCIENCE & ENGG