Skip to content

Instantly share code, notes, and snippets.

@6uclz1
Created October 12, 2015 05:09
Show Gist options
  • Save 6uclz1/3b4ba252ebb9b75e3823 to your computer and use it in GitHub Desktop.
Save 6uclz1/3b4ba252ebb9b75e3823 to your computer and use it in GitHub Desktop.
//mondai1
#include <stdio.h>
int main()
{
int i, score[5], max = 0, min = 0, sum = 0;
for (i = 0; i < 5; ++i){
printf("[%d] input >>> ", i);
scanf("%d", &score[i]);
if(score[max] < score[i]) max = i;
if(score[min] > score[i]) min = i;
sum = sum + score[i];
}
int ave = sum / i;
printf("max: %d score: %d \n", max, score[max]);
printf("max: %d score: %d \n", min, score[min]);
printf("ave: %d \n", ave);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment