Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - C language decimal integer calculates the number of positive integers, using function calls.
C language decimal integer calculates the number of positive integers, using function calls.
# include & ltstdio.h & gt

int func(int *arr,int n)

{

int i,count = 0;

for(I = 0; I & ltn;; i++)

if(arr[I]& gt; 0)

count++;

Returns the count;

}

int main()

{

int a[ 10],I;

for(I = 0; I< 10; i++)

scanf("%d ",& ampa[I]);

Printf ("number of positive integers: %d \n", func(a,10));

Returns 0;

}

Example of running results:

- 1 -2 4 5 6 -9 -8 10 -3 0

The number of positive integers is: 4