C program to find Smallest and Largest elements from One Dimensional Array Elements
This program will read 10 elements and find the smallest and largest elements from inputted One Dimensional Array Elements.
To find Smallest element from the Array - We will assume that first element is smallest and assign it in a variable and then compare each element from array with the variable, if any of the element is smaller than variable assign that element into variable, finally we will get smallest elements.
To find Largest element from the Array - We will assume that first element is largest and assign it in a variable and then compare each element from array with the variable, if any of the element is larger than variable assign that element into variable, finally we will get largest elements.
Find Smallest and Largest elements from One Dimensional Array using C program
Output:
Enter elements : Enter arr[0] : 11 Enter arr[1] : 22 Enter arr[2] : 33 Enter arr[3] : 44 Enter arr[4] : 55 Enter arr[5] : 66 Enter arr[6] : 77 Enter arr[7] : 66 Enter arr[8] : 56 Enter arr[9] : 56 Largest element of array is : 77 Smallest element of array is : 11need an explanation for this answer? contact us directly to get an explanation for this answer