انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة

Looping Statements

Share |
الكلية كلية هندسة المواد     القسم قسم هندسة المعادن     المرحلة 2
أستاذ المادة رفاه ابراهيم جبار       10/03/2019 14:54:42
Looping Statements

Looping
Looping is the process of repeating a series of statements multiple times until a criteria is met.


Controlling Loops
Counter-controlled loops repeat a specific number multiple of times. It is useful when the programmer knows how many times the loop should be executed.
Initialize the counter by setting it to a beginning value before entering the loop.
The counter is incremented (or decremented) by the same value during each repetition.


Basic Components of Loops

Loop control variable: A variable used to determine whether a loop will be executed.
Loop body: The statement (s) that are executed each time a loop repeats.

Types of loop Structures

Do While ……. Loop
Do Until …… Loop
For …… Next loop


Do While ……. Loop
Is executed as long as the condition is True.
If condition is False then the next statement after the Loop is executed
The format of the Do While ……. Loop is as follow:





And the counter format is as follow:



.
…..,,,,





Example1:
Write a VB program to find S from the following series:
S=1/((a+b))+2/?(a+b)?^2 +3/?(a+b)?^3 +?+n/?(a+b)?^n
Find the value of S for each input values of a ,b and n.


المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
الرجوع الى لوحة التحكم