Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - C language, output all elements of an integer array a[ 10], the number of positive numbers, the number of negative numbers and the sum of all elements through pointers.
C language, output all elements of an integer array a[ 10], the number of positive numbers, the number of negative numbers and the sum of all elements through pointers.
Modify the code:

# include & ltstdio.h & gt

int? Master ()

{

int? a[ 10],? Me? *p,? b? =? 0,? c? =? 0,? sum? =? 0;

p? =? a;

Printf ("Please? Input? 10? Number: \ n ");

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

{

scanf("%d ",p);

p++;

}

p? =? a;

Printf ("Original array:? \ n ");

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

{

What if? (*p? & gt? 0)

b++;

What if? (*p? & lt? 0)

c++;

sum? +=? * p;

printf("%d?" ,? * p++);

}

printf(" \ n ");

Printf ("Number of positive integers:% d \ nNumber of negative integers:% d \ nSum:% d \ n",? b,? c,? sum);

Return? 0;

} output effect: