Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void input_scores(float score[], int n)
- {
- int c;
- printf("\n\n");
- printf("점수를 입력하세요.\n");
- for (c = 0; c<n; c++)
- {
- scanf("%f", &score[c]);
- }
- }
- int limit;
- float max = 0.0;
- float min = 100.0;
- float sum = 0.0;
- float max_score(float score[], int n)
- {
- limit = n - 1;
- n = 0;
- if (score[n] > max)
- {
- max = score[n];
- n++;
- return max_score(score, n);
- }
- if (n == limit)
- return max;
- }
- /*
- float min_score(float score[], int n)
- {
- }
- float sum_scores(float score[], int n)
- {
- }
- */
- void print_result(float max/*, float min, float sum, float mean*/)
- {
- printf("**************************\n");
- printf("최고점수: %f\n", max);
- /*printf("최저점수: %f\n", min);
- printf("합계점수: %f\n", sum);
- printf("평균점수: %f\n", mean);*/
- printf("**************************\n");
- }
- void main()
- {
- int n;
- float score[30];
- float max, min, sum, mean;
- printf("학생수? ");
- scanf("%d", &n);
- input_scores(score, n);
- max = max_score(score, n);
- /*min = min_score(score, n);
- sum = sum_scores(score, n);
- mean = sum / (float)n;*/
- print_result(max/*, min, sum, mean*/);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement