This is a C++ program to find the smallest element in the array. with the help of the loop, we are going to execute this program.
1. First Create an array "arr" and assign some values.
2. Create an integer smallest to find the smallest element of the array.
3. Assigning the Smallest, first element of the array(Assuming the first element is the smallest element in the array).
4. With the help of a loop we iterate each and every element of the array to find the smallest element in the array .
5. With the help of this Condition " arr[i]<smallest" we are checking that there is any smallest element in the array.
6. After Checking each element of the array we are printing the smallest element of the array.
Submitted by Ashish Kumar Gupta (ashishkrgupta)
Download packets of source code on Coders Packet