Created
October 26, 2015 14:27
-
-
Save 6uclz1/89f0fd6d965c4e8f996c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//mondai1 | |
#include <stdio.h> | |
int ave(int[], int); | |
int main() | |
{ | |
int num[5], i; | |
for(i = 0; i < 5; i++) { | |
printf("%s", "? "); | |
scanf("%d", &num[i]); | |
} | |
printf("Average: %d\n", ave(num, 5)); | |
} | |
int ave(int num[], int n) | |
{ | |
int i, sum = 0; | |
for(i = 0; i < n; i++) sum = sum + num[i]; | |
return sum / n; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment