```1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 ``` ```/*4. write a program which will accept both positive and negative integers from the user until 999 is entered to stop the prog. sum up both sets of num separately and determine the smallest and largest num from both sets, display these results. by Carey Riley, Student ID MO/10/7220/MS*/ #include #include //int sum_minus(*,int); //prototype for sum of minus array //int sum_plus(*int, int); //prototype for sum of plus array int sum(int *, int); main() { int num, count = 0, minus_total, plus_total, total;//*a, //array_amount,; int *plus, *minus; printf("Enter 999 to exit.\n\n"); do{ //start of request loop printf("Enter an integer, negative or positive:\n"); scanf("%i",&num); /*procedure to fill array*/ if(num >= 0) { *(plus + count) = &num ; count ++; } else { *(minus + count) = &num ; count++ ; } } while( num != 999 ); //array_amount = count ; //a = plus ;//assign to pointer for function call plus_total = sum(plus, count) - 999 ; //a = minus ; //assign to pointer for function call minus_total = sum(minus, count) ; /*How do I sort the elements in an array?*/ //printout of totals printf("The sum of negative integers is %i.\n", minus_total); printf("The sum of positive integers is %i.\n\n", plus_total); //minus_total > plus_total ? printf("%i is a larger number than %i.", minus_total, plus_total) : printf("%i is a larger number than %i.", plus_total, minus_total) ; getchar(); } //int sum_minus(*a,b) int sum(int *a, int populace) { int b, total = 0; for (b = 0; b <= populace; b++ ) { total+=*(a+b); } ; return total; } ```