## C Program to Calculate Average of Array Elements

In this program, the user is ask to enter 5 integer elements that will save in array arr. Then we calculate the sum and average of these number display it on console.

##### Source Code
``````#include<stdio.h>

int main()
{
int arr, i, sum = 0;
float avg;

printf("Enter 5 array students\n");
/* Input marks of 10 students */
for(i=0; i<5; i++)
scanf("%d", &arr[i]);

/* Logic to calculate sum and average*/
for(i=0; i<5; i++)
{
sum = sum + arr[i];
}
avg = sum / 5;

/* Print sum */
printf("\nSum = %d", sum);
printf("\nAverage = %0.2f", avg);
return 0;
}``````
##### Output
``````Enter 5 array students
4 2 5 8 6

Sum = 25
Average = 5.00``````
{"ft_lang_label":"__label__en","ft_lang_prob":0.600769,"math_prob":0.99855846,"size":654,"snap":"2023-40-2023-50","text_gpt3_token_len":205,"char_repetition_ratio":0.11384615,"word_repetition_ratio":0.0,"special_character_ratio":0.37767583,"punctuation_ratio":0.16216215,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9988581,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-09-27T17:19:40Z\",\"WARC-Record-ID\":\"<urn:uuid:0b296f27-e3ec-499c-957f-105474dfb2e0>\",\"Content-Length\":\"13691\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:83bea9e1-7acf-48e2-a9fb-0eaa898adfd7>\",\"WARC-Concurrent-To\":\"<urn:uuid:3b45b844-8d7d-4922-983f-90220c192d3c>\",\"WARC-IP-Address\":\"103.152.79.223\",\"WARC-Target-URI\":\"http://www.programmingtutorials4u.online/c-programming/programs/array-average/\",\"WARC-Payload-Digest\":\"sha1:Q5HEEHUFKJQ2JOFFW7B3HCSSP7GQ72XW\",\"WARC-Block-Digest\":\"sha1:VRM7H772FFZUWF4UQV33HD5XIFOD7R4M\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233510319.87_warc_CC-MAIN-20230927171156-20230927201156-00175.warc.gz\"}"}