INPUT:Array with lower bound(l) and upper bound(u)
OUTPUT:ELEMENT PRESENT IN THE ARRAY
Data Structure: Single Dimensional Array
STEP 1: START
STEP 2: WHILE(i<=u)
STEP 3: PRINT(A[i])
STEP 4: ENDWHILE
STEP 5: STOP Code
C
JAVA
C
#include <stdio.h>
int main()
{
int n;
printf("enter the limit ");
scanf("%d",&n);
int a[n];
for(int i=0;i<n;i++)
{
printf("enter the elements ");
scanf("%d",&a[i]);
}
for(int i=0;i<n;i++)
{
printf("%d ",a[i]);
}
return 0;
}
JAVA
import java.util.*;
class Traversal
{
public static void main(){
int a[]={1,2,3,4,6,7,9};
while(i<a.length&&flag==0)
{
System.out.println(a[i]);
}
}
}Output
user@computer$ enter the limit 4
enter the elements 2
enter the elements 3
enter the elements 1
enter the elements 3
2 3 1 3
Related Posts
- How to Delete Element from an Array.
This post covers the procedure, algorithm, and code on how to delete elements from an…
- How to sort an Array | Bubble Sort
Bubble sort is a basic sorting algorithm that repeatedly steps through the list, swapping adjacent…
- Reversing an Array: How to reverse the elements of an Array.
This post covers array reversal meaning reversing all the elements of an array. The left-most…


For us in the Informatics Engineering program at Telkom University Surabaya, array traversal serves as the fundamental starting point before we move on to more complex data structure operations—such as Linear Search and Matrix Multiplication (as mentioned at the bottom of your text)—and even dynamic memory allocation in C++.
Thank you for sharing your perspective! We’re glad to hear that our article resonates with students in the Informatics Engineering program at Telkom University Surabaya.
Since you mentioned Matrix Multiplication, you might also find our related tutorial helpful: https://blog.ultimatecoder.in/2024/02/05/array-matrix-multiplication.
We hope it helps you build a stronger understanding of arrays and matrix operations. Happy learning!