Professional Documents
Culture Documents
CCP503
CCP503
CCP503
ANDHRAPRADESH
Name : K.Sreeramacharyulu
Designation : Lecturer
Branch : Commercial and Computer Practice
Institute : Govt Polytechnic, Srikakulam
Year/Semester : V Semester
Subject : VISUAL BASIC-I
Sub. Code : CCP-503
Topic : Programming Fundamentals Know the
structure of VB applications
Duration : 50 Minutes
Sub. Topic : Know the Recursion concept in VB
Teaching Aids : PPT, Clips and Images
CCP503.39 1
Objectives
CCP503.39 2
RECAP
4. Built-in functions
CCP503.39 3
THE RECURSION IN VB
CCP503.39 4
A simple Example : Write a program in VB to accept
a number and then compute its factorial by using
Recursion concept.
N! = N * (N - 1)!
CCP503.39 5
The factorial of N is the number N multiplied by the
factorial of (N - 1), which in turn multiplied by factorial
of (N – 1), which in turn is ( N – 1) multiplied by
factorial of (N – 2) and so on, until we reach 0!, which
is ‘1’
CCP503.39 6
Here’s the process of calculation of the factorial of
Number 5 : 5 != 120
CCP503.39 7
For the mathematically inclined, the factorial of
the number N is defined as follows:
N! = 1 If N is zero
CCP503.39 8
Program to compute Factorial Using
Recursion
CCP503.39 9
Enter code for ”Click here to calculate Factorial”
button and define a function factorial respectively
Now run application
Enter an integer value in text1 & click calculate
button
Now the Factorial value of integer value will be
displayed in Text2 Box named as Txtfact as in Fig
39.1
The code window containing real recursion program
in fig 39.2 as given below.
CCP503.39 10
Fig 39.2 CCP503.39 11
Fig 39.1 CCP503.39 12
Program to display Fibonacci series
using Recursion
CCP503.39 13
Enter code for calculate button and define a
function Fibonacci respectively
CCP503.39 14
Fig 39.3 CCP503.39 15
ADVANTAGES OF RECURSION
CCP503.39 16
SUMMARY
CCP503.39 17
FREQUENTLY ASKED QUESTIONS
CCP503.39 18
QUIZ
CCP503.39 19
2. Which data structure must be supported by the VB
internally in order to have Recursion concept?
A. Linear Queue
b) Stack
c) Binary Tree
d) Circular Queue
CCP503.39 20
ASSIGNMENT
1. Explain the advantages of recursion
CCP503.39 21