SlideShare a Scribd company logo
1 of 17
Presentation on:
Array and Do-
While Loop
SUBMITTED BY: Juhi Kumari
ARRAYS
 An array isacontiguouscollection of
storagelocationsthat aredefined by a
singlename.
 Each element of an array hasan unique
number of identification called INDEX
or SUBSCRIPT.
 Making changesto any oneelement of
an array doesnot affect other element of
array.
Types of array
 Single dimensional:
 It has only one subscript.
 They are used to store data
sequentially.
 Only linear data can be presented
in this way.
 Eg: roll no of students.
Declaring Single Dimension
Array
An array is declared using the following syntax:
Dim ArrayName(MaxIndex) as VariableType
Eg: Dim num(5) as integer
OR
Dim ArrayName(LowerBound To UpperBound) as
VariableType
Eg: Dim num(1 to 5) as integer
The LowerBound of the array is the lowest index in
the array, while the UpperBound is the highest index
in the array
Dynamic Arrays
 Dynamic array are those whose size is set
at run time.
 These type of arrays are very flexible
through which we can manage memory
efficiently.
 If some data is no longer needed we can
released the memory occupied by them.
 SYNTEX:
Dim arrayname()
ReDim arrayname()
Example:
Dim num() as integer
Redim num(5)
For k=1 to 5
num(k)=100+k
Next
-Each time redim statement is
executed
all the values stored in array are
lost.
-All the elements values are reset
like fresh array.
-We can use keyword PRESERVE to
resize the array without losing the
existing data.
Syntex:
redim PRESERVE arrayname(index) as integer
example:
redim x(1 to 10) as integer
for j=0 to 10
x(j)= j
print x(j)
next
redim preserve x(1 to 5) as integer
for j=1 to 5
print x(j)
next
Multi dimensional array
(two or three)
 It has two or more subscripts.
 They are easy to manipulate as they
are arranged in rows and columns.
Eg: matrix.
Declaring multidimensional
Array
To define a two-dimensional array or table —
Dim statement specifies number of rows and
columns.
The row is horizontal and the column is vertical.
May specify number of elements initial values
Specify row with first subscript, column with
second subscript, and use a comma to specify the
dimensions.
The Dim Statement for Two-Dimensional
Arrays — General Form
Dim ArrayName(highestRowSubscript,lowestColumnSubscript)
as VariableType
Eg: dim mat(3,3) as integer
for i=1 to 3
for j=0 to 3
mat(I,j)=inputbox(“enter element rowWise”)
next j
next i
Output:
12
(0,0)
10
(0,1)
17
(0,2)
19
(1,0)
11
(1,1)
10
(1,2)
12
(2,0)
6
(2,1)
11
(2,2)
Do......Loop
It executes a blocks of statement as
long as condition is true. Condition is
specified with Do is evaluated. if it is
true then statement are executed
otherwise execution continues from
statement written immediately after
Do.....Loop.
Do While......Loop
 This construct first tests the condition.
 If the condition is true only then control enters
the loop otherwise loop is never executed.
 If the condition is true then statement written
between Do and Loop are executed as long as
condition remains true. when it becomes false
Loop is terminated and execution continues
from statement.
 Syntax:
Do While <condition>
statements
Loop
Program(using do-loop):
Display 1 to 10 number.
I = 1
Do
print I
I = I+1
Loop While (I <= 10)
Program(using do-while):
Display 1 to 10 number.
I = 1
Do While (I <= 10)
print I
I = I+1
Loop
Arrays

More Related Content

What's hot (20)

Array in c
Array in cArray in c
Array in c
 
R data types
R   data typesR   data types
R data types
 
Chap 7(array)
Chap 7(array)Chap 7(array)
Chap 7(array)
 
Arrays in c language
Arrays in c languageArrays in c language
Arrays in c language
 
Introduction to Array ppt
Introduction to Array pptIntroduction to Array ppt
Introduction to Array ppt
 
Basic array in c programming
Basic array in c programmingBasic array in c programming
Basic array in c programming
 
3 Data Structure in R
3 Data Structure in R3 Data Structure in R
3 Data Structure in R
 
Array in C
Array in CArray in C
Array in C
 
Data structure
Data structureData structure
Data structure
 
Array in c
Array in cArray in c
Array in c
 
Stacks, Queues, Binary Search Trees - Lecture 1 - Advanced Data Structures
Stacks, Queues, Binary Search Trees -  Lecture 1 - Advanced Data StructuresStacks, Queues, Binary Search Trees -  Lecture 1 - Advanced Data Structures
Stacks, Queues, Binary Search Trees - Lecture 1 - Advanced Data Structures
 
Array 2 hina
Array 2 hina Array 2 hina
Array 2 hina
 
Arrays in c
Arrays in cArrays in c
Arrays in c
 
Array in c programming
Array in c programmingArray in c programming
Array in c programming
 
Multiplication of two 3 d sparse matrices using 1d arrays and linked lists
Multiplication of two 3 d sparse matrices using 1d arrays and linked listsMultiplication of two 3 d sparse matrices using 1d arrays and linked lists
Multiplication of two 3 d sparse matrices using 1d arrays and linked lists
 
Array in C
Array in CArray in C
Array in C
 
Array in (C) programing
Array in (C) programing Array in (C) programing
Array in (C) programing
 
Array
ArrayArray
Array
 
Structured Data Type Arrays
Structured Data Type ArraysStructured Data Type Arrays
Structured Data Type Arrays
 
User defined data type
User defined data typeUser defined data type
User defined data type
 

Similar to Arrays

Similar to Arrays (20)

2 data structure in R
2 data structure in R2 data structure in R
2 data structure in R
 
Svm Presentation
Svm PresentationSvm Presentation
Svm Presentation
 
Unit 2
Unit 2Unit 2
Unit 2
 
arrays.docx
arrays.docxarrays.docx
arrays.docx
 
Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT
Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT
Arrays in C++ in Tamil - TNSCERT SYLLABUS PPT
 
Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm
 
Introduction to Arrays in C
Introduction to Arrays in CIntroduction to Arrays in C
Introduction to Arrays in C
 
data structure programing language in c.ppt
data structure programing language in c.pptdata structure programing language in c.ppt
data structure programing language in c.ppt
 
DS_PPT.pptx
DS_PPT.pptxDS_PPT.pptx
DS_PPT.pptx
 
Lecture 2a arrays
Lecture 2a arraysLecture 2a arrays
Lecture 2a arrays
 
Module 4- Arrays and Strings
Module 4- Arrays and StringsModule 4- Arrays and Strings
Module 4- Arrays and Strings
 
arrays-130116232821-phpapp02.pdf
arrays-130116232821-phpapp02.pdfarrays-130116232821-phpapp02.pdf
arrays-130116232821-phpapp02.pdf
 
Module7
Module7Module7
Module7
 
Homework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdfHomework Assignment – Array Technical DocumentWrite a technical .pdf
Homework Assignment – Array Technical DocumentWrite a technical .pdf
 
Arrays
ArraysArrays
Arrays
 
Chapter 08
Chapter 08Chapter 08
Chapter 08
 
R for Statistical Computing
R for Statistical ComputingR for Statistical Computing
R for Statistical Computing
 
Collection
Collection Collection
Collection
 
Numpy ndarrays.pdf
Numpy ndarrays.pdfNumpy ndarrays.pdf
Numpy ndarrays.pdf
 
Unit 6. Arrays
Unit 6. ArraysUnit 6. Arrays
Unit 6. Arrays
 

Recently uploaded

Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 

Recently uploaded (20)

Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 

Arrays

  • 1. Presentation on: Array and Do- While Loop SUBMITTED BY: Juhi Kumari
  • 2. ARRAYS  An array isacontiguouscollection of storagelocationsthat aredefined by a singlename.  Each element of an array hasan unique number of identification called INDEX or SUBSCRIPT.  Making changesto any oneelement of an array doesnot affect other element of array.
  • 3. Types of array  Single dimensional:  It has only one subscript.  They are used to store data sequentially.  Only linear data can be presented in this way.  Eg: roll no of students.
  • 4. Declaring Single Dimension Array An array is declared using the following syntax: Dim ArrayName(MaxIndex) as VariableType Eg: Dim num(5) as integer OR Dim ArrayName(LowerBound To UpperBound) as VariableType Eg: Dim num(1 to 5) as integer The LowerBound of the array is the lowest index in the array, while the UpperBound is the highest index in the array
  • 5. Dynamic Arrays  Dynamic array are those whose size is set at run time.  These type of arrays are very flexible through which we can manage memory efficiently.  If some data is no longer needed we can released the memory occupied by them.  SYNTEX: Dim arrayname() ReDim arrayname()
  • 6. Example: Dim num() as integer Redim num(5) For k=1 to 5 num(k)=100+k Next
  • 7. -Each time redim statement is executed all the values stored in array are lost. -All the elements values are reset like fresh array. -We can use keyword PRESERVE to resize the array without losing the existing data.
  • 8. Syntex: redim PRESERVE arrayname(index) as integer example: redim x(1 to 10) as integer for j=0 to 10 x(j)= j print x(j) next redim preserve x(1 to 5) as integer for j=1 to 5 print x(j) next
  • 9. Multi dimensional array (two or three)  It has two or more subscripts.  They are easy to manipulate as they are arranged in rows and columns. Eg: matrix.
  • 10. Declaring multidimensional Array To define a two-dimensional array or table — Dim statement specifies number of rows and columns. The row is horizontal and the column is vertical. May specify number of elements initial values Specify row with first subscript, column with second subscript, and use a comma to specify the dimensions.
  • 11. The Dim Statement for Two-Dimensional Arrays — General Form Dim ArrayName(highestRowSubscript,lowestColumnSubscript) as VariableType Eg: dim mat(3,3) as integer for i=1 to 3 for j=0 to 3 mat(I,j)=inputbox(“enter element rowWise”) next j next i
  • 13. Do......Loop It executes a blocks of statement as long as condition is true. Condition is specified with Do is evaluated. if it is true then statement are executed otherwise execution continues from statement written immediately after Do.....Loop.
  • 14. Do While......Loop  This construct first tests the condition.  If the condition is true only then control enters the loop otherwise loop is never executed.  If the condition is true then statement written between Do and Loop are executed as long as condition remains true. when it becomes false Loop is terminated and execution continues from statement.  Syntax: Do While <condition> statements Loop
  • 15. Program(using do-loop): Display 1 to 10 number. I = 1 Do print I I = I+1 Loop While (I <= 10)
  • 16. Program(using do-while): Display 1 to 10 number. I = 1 Do While (I <= 10) print I I = I+1 Loop