Ok, I am an MIS major and am taking my first programming class. This is a "simple" program that we have been assigned and I can not afford to lose much more hair. Hopefully it is ok that I post all of this but these are the instructions and the program that I have written so far. Please, any help is great!!

Instructions:

Write a program in C that will use a sentinel controlled loop to allow the user to input as many single digit integers (0,1,2,3,4,5,6,7,8,or 9) as wished. When the user enters –1 to end input, the program will print the smallest digit entered (other than –1), the largest digit entered, and the sum of the digits entered(other than –1). The screen should look something like the following:

Enter a one digit integer (0,1,2,3,.,8,9 or -1 to quit): 3

Enter a one digit integer (0,1,2,3,.,8,9 or -1 to quit): 6

Enter a one digit integer (0,1,2,3,.,8,9 or -1 to quit): 5

Enter a one digit integer (0,1,2,3,.,8,9 or -1 to quit): 7

Enter a one digit integer (0,1,2,3,.,8,9 or -1 to quit): -1

The smallest digit entered was : 3

The largest digit entered was : 7

The total of the digits entered was: 21

Goodbye!!

Or

Enter a one digit integer (0,1,2,3,.,8,9 or -1 to quit): 6

Enter a one digit integer (0,1,2,3,.,8,9 or -1 to quit): 6

Enter a one digit integer (0,1,2,3,.,8,9 or -1 to quit): 6

Enter a one digit integer (0,1,2,3,.,8,9 or -1 to quit): 6

Enter a one digit integer (0,1,2,3,.,8,9 or -1 to quit): 6

Enter a one digit integer (0,1,2,3,.,8,9 or -1 to quit): -1

The smallest digit entered was : 6

The largest digit entered was : 6

The total of the digits entered was: 30

Goodbye!!

Note: If the user enters –1 as the first entry (i.e. no digits from 0 to 9 were entered), the screen should look something like:

Enter a one digit integer (0,1,2,3,.,8,9 or -1 to quit): -1

No digits were entered!

Goodbye!!

This is what I have and where I am stuck:

Code:#include <stdio.h> int main() { int total; int smallest; int largest; int counter; int integer; total = 0; counter = 0; printf("Enter a one digit integer (0,1,2,3,.,8,9 or -1 to quit): "); scanf("%d", &integer); while ( integer != -1) { total = total + integer; counter = counter + 1; printf("Enter a one digit integer (0,1,2,3,.,8,9 or -1 to quit): "); scanf("%d", &integer ); } largest = integer; smallest = integer; if( integer > largest) largest = integer; if(integer < smallest) smallest = integer; while ( counter = -1){ printf("No digits were entered\nGoodbye!!\n"); } printf( "The smallest digit entered was %d\n", smallest ); printf( "The largest digit entered was %d\n", largest ); printf( "The total of the digits entered was %d\n", total ); printf( "Goodbye!!\n" ); return 0; }