## perform operation on array,c program of all operation on array,c operation on array

#include"stdio.h"
#include"conio.h"
void main()
{
int no[20],i,lim,mini,maxi,sum=0,od=0,e=0,p=0,n=0,z=0,key,ch,flag;
clrscr();
printf("How many number you enter in array=");
scanf("%d",&lim);
mini=maxi=no[0];
for(i=0;i<lim;i++)
{
printf("\nEnter %d number=",i+1);
scanf("%d",&no[i]);
sum=sum+no[i];
if(no[i]<mini)
{
mini=no[i];
}
if(no[i]>maxi)
{
maxi=no[i];
}
if(no[i]%2==0)
{
e++;
}
else
{
od++;
}
if(no[i]>0)
{
p++;
}
else if(no[i]<0)
{
n++;
}
else
{
z++;
}
}
do
{
printf("\n\n\n1.Find Minimum.");
printf("\n2.Find Maximum.");
printf("\n3.Find Average.");
printf("\n4.Count Odd.");
printf("\n5.Count Even.");
printf("\n6.Count Positive.");
printf("\n7.Count Negative.");
printf("\n8.Count Zero.");
printf("\n9.Search Number.");
scanf("%d",&ch);
switch(ch)
{
case 1:printf("\n Minimum number is=%d",mini);
break;
case 2:printf("\n Maximum number is=%d",maxi);
break;
case 3:printf("\n Average is=%.2f",(float)sum/lim);
break;
case 4: if(od>0)
{
printf("\n Odd count is=%d",od);
break;
}
else
{
printf("\n No odd number found.");
break;
}
case 5: if(e>0)
{
printf("\n Even count is=%d",e);
break;
}
else
{
printf("\n No even number found.");
break;
}

case 6: if(p>0)
{
printf("\n Positive count is=%d",p);
break;
}
else
{
printf("\n No positive number found.");
break;
}

case 7: if(n>0)
{
printf("\n Negative count is=%d",n);
break;
}
else
{
printf("\n No negative number found.");
break;
}
case 8: if(z>0)
{
printf("\n Zero count is=%d",z);
break;
}
else
{
printf("\n No zero number found.");
break;
}
case 9:printf("\n\nEnter the value you want to find=");
scanf("%d",&key);
flag=0;
for(i=0;i<lim;i++)
{
if(key==no[i])
{
flag=1;
break;
}
}
if(flag==1)
{
printf("\n\n%d is present in array.",key);
}
else
{
printf("\n\n%d is not present in array,",key);
}
}
}while(ch<10);
getch();
}