#include<stdio.h>
#include<stdlib.h>
int main()
{
int i,n,large,small;
int *a =NULL;
printf("\n enter the the number of elements \n");
scanf("%d",&n);
a=(int*)malloc(n*sizeof(int));
printf("\n Intput the arrays elements");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
large=small=a[0];
for(i=1;i<n;i++)
{
if(a[i]>large)
large=a[i];
if(a[i]<small)
small=a[i];
}
printf("\nthe samller elements is %d\n",small);
printf("\nthe larger elements is %d\n",large);
return 0;
}
0 Comments