Q25. Write a code to find smallest element in an array

For Example :-
input : arr[]={ 5,5,8,3,5}
output : 3

So as we can see that the smallest element in arr[] = { 5,5,8,3,5} is 3 so the output is 3.

Algorithm  for Smallest element in an array 

START
Step 1 → Take an array Arr and define its values
Step 2 → Declare one variable (VAR) and assign 1st element of array to it
Step 3 → Loop for each value of Arr Repeat Step 4
Step 4 → If Arr[I] < VAR, Assign Arr[I] to VAR
Step 5 → After loop finishes, Display VAR which holds the smallest element of array
STOP

Code for Smallest element in an array 

Output

Smallest element in an Array is =3

Recommended Programs
Program to find factorial of a number
Program to count number of digits in a number