C Program to Find Largest and Smallest Element in Array

Here is the C program to find the largest and smallest element in a one dimensional (1-D) array.



How many elements:5
Enter the Array:1 8 12 4 6
The largest element is 12
The smallest element is 1

23 thoughts on “C Program to Find Largest and Smallest Element in Array

    1. Admin Post author

      I think program is correct, for what input it is giving wrong answer?

    2. Krishna mohan

      Yes in above program big variable is stores a[0] instead of the 0 value ….

  1. Urvashi

    why don’t have you assigned large and small with 0 as it might take garbage value?

    1. Muhammed Ajmal

      @Urvashi that not an intialization. he just take the first element in the array that 0 is the index number.

  2. Swati

    Is this programm correct or not.because i am not satisfied this program output….

  3. srinithi

    sum of except largest and smallest element in a array c programming

  4. Pushpa

    that program is correct but give average of except 2nd large and 2nd small numbers

  5. nitu

    I think program is right but the output is not correct. it is giving a garbage type value.

  6. nitu

    what ‘s reason behind giving the wrong output in this program. as the program seems to be correct.

  7. lalitha

    difference between smallest and biggest elemnts of a given array.please tell me how to solve this in c language

  8. Jennifer

    The above code is correct. Those who have doubts, just contact me I will explain it clearly.

  9. Moetorious

    2 questions:

    1. How can I use this to compute difference between maximum and minimum

    2. How do I make it so when I input array, it is separated by commas


Leave a Reply

Your email address will not be published. Required fields are marked *