C Program to Find Largest Element in Array
###### Posted by Samath
Last Updated: January 02, 2017

Write a C program to read elements in an array and find the largest element in the array.

Code:

```#include<stdio.h>

int main() {
int a[30], i, num, largest;

printf("\nEnter no of elements :");
scanf("%d", &num);

//Read n elements in an array
for (i = 0; i < num; i++)
scanf("%d", &a[i]);

//Consider first element as largest
largest = a[0];

for (i = 0; i < num; i++) {
if (a[i] > largest) {
largest = a[i];
}
}

// Print out the Result
printf("\nLargest Element : %d", largest);

return (0);
}```

###### C program to find smallest element in array
Samath | Jan 02, 2017
###### How can you find the second largest element in a list in Python?
AliceWk | Aug 19, 2024
###### Write a Python function to find the kth largest element in a list.
BobHarris | Aug 28, 2024
###### How can you find the largest element in a list using recursion in Python?
AliceWk | Aug 12, 2024
###### Write a Python function to find the kth largest element in an unsorted list.
LeoRobs | Aug 25, 2024
###### C Program to Search an element in Array
Samath | Jan 02, 2017
###### C Program to Insert an element in an Array
Samath | Jan 02, 2017
###### C program to delete an element from an array
Samath | Jan 02, 2017
###### Write a C program to Print Square of Each Element of 2D Array Matrix
Samath | Jan 04, 2017
###### C++ program that find the largest number and counts its occurrences
Samath | Jan 20, 2024
###### Java program that reads in three floatingĀ­ point numbers and prints the largest of the three inputs
Samath | Feb 12, 2021
###### Java program that read a sequence of integer inputs and print the smallest and largest of the inputs
Samath | Apr 03, 2022
###### Transposing an array using C++
Samath | Jan 07, 2021
###### C Program to Reverse an Array
Samath | Jan 02, 2017