![]() |
In C, arrays are data structures that allow the user to store a collection of data of the same type. In this article, we will learn how we can find the maximum value in an array in C. Example Input: arr = {5,3,1,2,4} Output: The maximum value of the array is: 5 Finding Maximum Value in an Array in CWe can find the maximal value in an array by taking a variable max and repeatedly comparing it to the elements of the array using loops. Algorithm
C Program to Find the Maximum Value in an ArrayC
Output
Array Elements: 23 12 45 20 90 89 95 32 65 19 The maximum value of the array is: 95 Time Complexity: O(N) where N is the number of elements in the array. |
Reffered: https://www.geeksforgeeks.org
C Language |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 13 |