A function Count is passed a double array along with two other parameters val and dval, val indicates the number of elements in the aarray and dval is a user entered double value. The function computes and returns the number of values in the array that are greater than dval.
#include<stdio.h>
main(){
int i, val,dval;
printf("enter the no of elements\n");
scanf("%d",&val);
double arr[val];
printf("enter the elements\n");
for (i = 0; i < val; i++)
{
scanf("%u",&arr[i]);
}
printf("the array entered by you is\n");
for (i = 0; i < val; i++)
{
printf("%u,",arr[i]);
}
printf("\nenter double type value\n");
scanf("%u",&dval);
printf("%u",dval);
printf("\nsum = %d\n",count(arr,val,dval));
}
int count(double arr[],int val,double dval)
{
int i;
int sum=0;
for(i=0;i<val;i++)
{
if(arr[i] > dval)
{ printf("%d",arr[i]);
sum++;
}
}
return sum;
}