/*******************(soeasyprograms.blogspot.in)***********************/
/* wap to find ith maximum and jth minimum from an array */
#include<stdio.h>
#include<conio.h>
void main()
{
int a[20],i,n,big,small;
clrscr();
printf(" enter the size of array ");
scanf("%d",&n);
printf("enter the elements of array");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
small=big=a[0];
for(i=0;i<n;i++)
{
if(big<a[i])
{
big=a[i];
}
}
for(i=0;i<n;i++)
{
if(small>a[i])
{
small=a[i];
}
}
printf("\nthe smallest element of array is =%d",small);
printf("\nthe maximum element of array is =%d",big);
getch();
}
/*******************(soeasyprograms.blogspot.in)***********************/
No comments:
Post a Comment