#include<iostream.h>
#include<conio.h>
void main()
{ clrscr();
int a[20],n,i,max,min;
cout<<"\nEnter Size Of Array: ";
cin>>n;
cout<<"\nEnter Array: ";
for(i=0;i<n;i++)
cin>>a[i];
max=min=a[0];
for(i=0;i<n;i++)
{ if(a[i]<min)
min=a[i];
if(a[i]>max)
max=a[i];
}
cout<<"\nMinimum In Array Is: "<<min;
cout<<"\nMaximum In Array Is: "<<max;
getch();
}
#include<conio.h>
void main()
{ clrscr();
int a[20],n,i,max,min;
cout<<"\nEnter Size Of Array: ";
cin>>n;
cout<<"\nEnter Array: ";
for(i=0;i<n;i++)
cin>>a[i];
max=min=a[0];
for(i=0;i<n;i++)
{ if(a[i]<min)
min=a[i];
if(a[i]>max)
max=a[i];
}
cout<<"\nMinimum In Array Is: "<<min;
cout<<"\nMaximum In Array Is: "<<max;
getch();
}
No comments:
Post a Comment