Program : Find Smallest Element in Array in C Programming
// ------------------------------------------------------ // Title : Find out smallest Number From Array // smallest - It Stores the smallest number // ------------------------------------------------------ #include<stdio.h> #include<conio.h> void main() { int a[30],i,n,smallest; printf("\n Enter no of elements :"); scanf("%d",&n); /* read n elements in an array */ for(i=0 ; i < n ; i++) scanf("%d",&a[i]); smallest = a[0]; for(i = 0 ;i < n ; i++) { if ( a[i] < smallest ) smallest = a[i]; } /* Print out the Result */ printf("\nSmallest Element : %d",smallest); getch(); }
Incoming search terms:
- c array find smallest string (1)
- C program to display smallest element in an array (1)
- find a smallest element in array in c using function (1)
- find smallest element in array c (1)
- program to find the smallest number using arrays in c programming language (1)
- smallest element in array using pointer in c (1)