#include<stdio.h> #include<conio.h> void main() { clrscr(); int small, arr[50], size, i; printf("Enter Array Size (max 50) : "); scanf("%d",&size); printf("Enter array elements : "); for(i=0; i<size; i++) { scanf("%d",&arr[i]); } printf("Searching for smallest element ...\n\n"); small=arr[0]; for(i=0; i<size; i++) { if(small>arr[i]) { small=arr[i]; } } printf("Smallest Element = %d",small); getch(); }
C program to find the smallest element in array.
Reviewed by
on
December 25, 2019
Rating:
No comments: