Академический Документы
Профессиональный Документы
Культура Документы
ANDHRAPRADESH
Name : K.Sreeramacharyulu
Designation : Lecturer
Branch : Commercial and Computer
Practice
Institute : Govt Polytechnic, Srikakulam
Year/Semester : V Semester
Subject : VISUAL BASIC-I
Sub. Cod : CCP-503
Topic : Programming Fundamentals
Duration : 50 Minutes
Sub. Topic : Programs on Loops
Teaching Aids : PPT, Clips and Images
CCP503.34 to 35 1
Objective:
CCP503.34 to 35 2
Recap
Loops
Decision Structures
CCP503.34 to 35 3
Programs on Do…Loop Structures
CCP503.34 to 35 4
Program on Do…Loop
CCP503.34 to 35 5
Fig 34.1
CCP503.34 to 35 6
Program1 On For…Next To Print All Even
Numbers In Between 0 To 20 Numbers On
Form
CCP503.34 to 35 7
Program1 On For…Next To Print All
Even Numbers In Between 0 To 20
Numbers On Form (Contd.)
CCP503.34 to 35 8
Fig 34.2
CCP503.34 to 35 9
Program 2 On For…next And An Array To
Accept List Of 10 Elements And Then Print
Them On The Form
Follow the steps to develop application:
CCP503.34 to 35 12
Fig 33.4
CCP503.34 to 35 13
Program on by using While…Wend to print
list of 5 numbers from 5, 10, 20… etc,.
CCP503.34 to 35 14
Fig 34.5
CCP503.34 to 35 15
Program Prime Number Test
CCP503.34 to 35 16
Output of Prime Number Test
Program
CCP503.34 to 35 17
Output of Prime Test Program
CCP503.34 to 35 18
Output of Prime Test Program
CCP503.34 to 35 19
Summary
Writing small programs in VB using control Flow
statements – Looping Structure like
Programs on Do….Loop
Programs on While.…Wend
Programs on For….Next etc,.
CCP503.34 to 35 20
Frequently Asked Questions
CCP503.34 to 35 21
Assignment
CCP503.34 to 35 22
Practice Programs on Do…Loop
Counter = 0
Do While counter <=1000
text1. text = counter
counter = counter+1
Loop
*The above example will keep on adding until >1000
The above example can be rewritten as
Do
text1 . text=counter
counter =counter+1
Loop until counter>1000
CCP503.34 to 35 23
Practice Programs on While…Wend
number=0
While number=>0
total= total + number
number =Input box (Please enter another value”)
wend
CCP503.34 to 35 24
Assignment
CCP503.34 to 35 25
Quiz
CCP503.34 to 35 26
1. What is the output of following program?
A. Prints 500,495,490,485,480,475……..10,5 on
screen
B. Prints 490,475,460,445,430…..40,25,10,-5 on
screen
C. Prints 500, 490, 480, 470, ….5
D. Prints 495, 490, 485, 480, ….0
CCP503.34 to 35 28