Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
730 B
2
Indexable
Never
#include<stdio.h>
#define SIZE 100
void gg(int a[], int *n)
{
	int i;
		printf("enter space: ");
		scanf("%d", n);
	for( i =0; i < *n; i++){
			printf("enter array: ");
		scanf("%d", &a[i]);
	}
}
void print(int a[] ,int n){
	int i;
	for( i = 0; i < n ; i++)
		printf("%d   ", a[i]);
	}
int mm(int a[], int n){
		int maxx= a[0];
		for (int i = 0;i < n;i++ ){
			if(a[i] > maxx){
				maxx = a[i];
			}
		}
		return maxx;
	}
int nn(int a[], int n){
		int minn= a[0];
		for (int i = 0;i < n;i++ ){
			if(a[i] < minn){
				minn = a[i];
			}
		}
		return minn;
	}
int main() {
	int a[SIZE], n;
	gg(a, &n);
	print(a, n);
	printf( "\n%d", nn(a,n));
	printf( "\n%d", mm(a,n));
	
return 0;
}