-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathg2.c
More file actions
30 lines (26 loc) · 671 Bytes
/
Copy pathg2.c
File metadata and controls
30 lines (26 loc) · 671 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <stdio.h>
void MinMax(int array[],int size,int *min,int *max);
int main(){
int array[100],size,max=0,i;
printf("Enter the size of your array :");
scanf("%d",&size);
printf("Enter the array elements : ");
for(i=0;i<size;i++){
scanf("%d",&array[i]);
}
int min=0;
MinMax(array,size,&min,&max);
printf("%d %d",min,max);
}
void MinMax(int array[],int size,int *min,int *max){
int i;
for(i=0;i<size;i++){
*min=array[size-i-1];
if(array[i]<*min){
*min=array[i];
}
else if(array[i]>*max){
*max=array[i];
}
}
}