It’s the smallest element or minimum element in an array C program that inputs numbers from the user, and stores these numbers in an array, then using the minimum element algorithm to find the minimum element in an array, and print result on the screen.
To understand this program, it’s better you should know the following topics:
Program (1): to find minimum element in an array, C programming.
#include<stdio.h> #include<conio.h> void main() { int a[100],i,min,n; printf("Enter the number of elements(upto 100) to be entered in the list : ",n); scanf("%d",&n); //accepting values into array for(i=0;i<n;i++) { printf("Enter %d element : ",i+1); scanf("%d",&a[i]); } //logic to find minimum element min=a[0]; for(i=1;i<n;i++) { if(min>a[i]) min=a[i]; } //Printing the minimum element printf("minimum element is %d",min); getch(); }
Output (1)
Enter the number of elements(upto 100) to be entered in the list : 3 Enter 1 element : 12 Enter 2 element : 23 Enter 3 element : 1 minimum element is 1