#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,max,min,arr[50];
printf("Enter the number of elements : ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\nEnter the value of Elements %d: ",i);
scanf("%d",&arr[i]);
}
max = arr[0];
min = arr[0];
for(i=1;i<n;i++)
{
if(arr[i]>max)
{
max = arr[i];
}
if(arr[i]<min)
{
min = arr[i];
}
}
printf("\nMaximum value is %d",max);
printf("\nMinimum value is %d",min);
getch();
}
0 Comments