C++ Programming Code Examples C++ > Arrays and Matrices Code Examples Programming Code to Find Smallest Element in Array Programming Code to Find Smallest Element in Array To find the smallest element in an array in C++ programming, you have to ask to the user to enter the array size and array elements, now start finding for the smallest element in the array to display the smallest element of the array as shown here in the following program. Following C++ program ask to the user to enter array size and array elements to find the smallest element present in the array, then display the result on the screen: /* C++ Program - Find Smallest Element in Array */ #include<iostream.h> #include<conio.h> void main() { clrscr(); int small, arr[50], size, j; cout<<"Enter Array Size (max 50) : "; cin>>size; cout<<"Enter array elements : "; for(j=0; j<size; j++) { cin>>arr[j]; } cout<<"Searching for smallest element ...\n\n"; small=arr[0]; for(j=0; j<size; j++) { if(small>arr[j]) { small=arr[j]; } } cout<<"Smallest Element = "<<small; getch(); }