You are on page 1of 1

#include<iostream.

h>
#include<conio.h>
void getextremes(float &min, float &max, float a[10], int n)
{
min=a[n-1];
max=0;
for(int i=0;i<n;i++)
{
if(min>a[i])
{
min=a[i];
}
if(max<a[i])
{
max=a[i];
}
}
}
void main()
{
clrscr();
float a[10],i,j,max=0,min=0;
int n;
cout<<"\n Enter the array size (max 10): ";
cin>>n;
cout<<"\n Enter the array elements: \n";
for(i=0;i<n;i++)
{
cin>>a[i];
}
getextremes(min,max,a,n);
cout<<"\n Minimum: "<<min;
cout<<"\n Maximum: "<<max;
getch();
}

You might also like