Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int GetMin_Max(int *a)
- {
- int x,b,c;
- for(x=0;x<5;x++)
- {
- if(x==0 || *(a+x)>b)
- {
- b=*(a+x);
- }
- if(x==0 || *(a+x)<c)
- {
- c=*(a+x);
- }
- }
- printf("최대값: %d, 최소값: %d\n",b,c);
- return 0;
- }
- int main (void)
- {
- int m;
- int a[5];
- printf("정수 5개를 입력하세요.\n");
- for(m=0;m<5;m++)
- {
- scanf("%d",&a[m]);
- }
- GetMin_Max(a);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment