# C Program to Find Largest Element in an Array

This post helps to find largest element in an array using the C programming language.

## C Program to Find Largest Element in an Array

```#include <stdio.h>
int main()
{
int array = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
int loop, largest;
largest = array;
for(loop = 1; loop < 10; loop++)
{
if( largest < array[loop] )
largest = array[loop];
}
printf("Largest element of array is %d", largest);
return 0;
}```

## Explanation

In this program, we find the largest array by initializing array values and variables like loop and largest. The array values will be stored in the variable namely largest.

```	int array = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
int loop, largest;
largest = array;```

Here we use the for loop condition and if condition. For loop condition is used for verifying whether the given condition is satisfying or not and If condition is used as a method to check the calculation of For loop condition.

```	for(loop = 1; loop < 10; loop++)
{
if( largest < array[loop] )
largest = array[loop];
}
printf("Largest element of array is %d", largest);
return 0;```

After the following checking and calculation part is completed. We now proceed to the output.
{"ft_lang_label":"__label__en","ft_lang_prob":0.71141285,"math_prob":0.93778276,"size":1237,"snap":"2021-43-2021-49","text_gpt3_token_len":340,"char_repetition_ratio":0.17518248,"word_repetition_ratio":0.33944955,"special_character_ratio":0.29830235,"punctuation_ratio":0.18181819,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.976091,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-10-24T09:49:06Z\",\"WARC-Record-ID\":\"<urn:uuid:0c410211-e370-4d4e-bb84-cf7b1896fc15>\",\"Content-Length\":\"108031\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:b944b351-0115-4d88-a1ec-d5f8315194e0>\",\"WARC-Concurrent-To\":\"<urn:uuid:4aa55080-92ce-477b-8f02-ac52e4e8454f>\",\"WARC-IP-Address\":\"104.21.50.173\",\"WARC-Target-URI\":\"https://abundantcode.com/c-program-to-find-largest-element-in-an-array/\",\"WARC-Payload-Digest\":\"sha1:GYH224FOIMEYPAWOB74NFR24SJTENFET\",\"WARC-Block-Digest\":\"sha1:FDWMLWVCDH6OBO3CSCXHCCAB6MXWCWHF\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-43/CC-MAIN-2021-43_segments_1634323585916.29_warc_CC-MAIN-20211024081003-20211024111003-00551.warc.gz\"}"}