Introduction
  • In this blog, I am going to explain how to find the minimum or smallest element present in an array.
Software Requirements
  • Turbo C++ OR C.
Programming
  1. #include < stdio.h > int main()
  2. {
  3. int array[100], minimum, size, c, location = 1;
  4. printf("Enter the number of elements in array\n");
  5. scanf("%d", & size);
  6. printf("Enter %d integers\n", size);
  7. for (c = 0; c < size; c++) scanf("%d", & array[c]);
  8. minimum = array[0];
  9. for (c = 1; c < size; c++)
  10. {
  11. if (array[c] < minimum)
  12. {
  13. minimum = array[c];
  14. location = c + 1;
  15. }
  16. }
  17. printf("Minimum element is present at location %d and it's value is %d.\n", location, minimum);
  18. return 0;
  19. }
Explanation
  • In the programming, given above, I have clearly explained about the minimum element in an array.

    programming
Output

Output
Conclusion
  • Thus, the program has been executed and printed successfully.