I keep getting syntax errors.
Code:
#include <stdio.h>
void main()
{
int number[10]; /* array of 10 numbers */
int count = 0; /* count through the amount of times entered */
long sum = 0L; /* The total amount of the numbers entered */
float average = 0.0f; /* average of the total / count */
int i = 0; /* count through the array */
char newnum; /* check if user wants to continue */
do /* do loop to go through the user input */
{
printf("\n Enter the numbers you wish to average:\n"); /* enter the numbers display to the user */
scanf("%d", &number[i]); /* read input */
printf("Would you like to add more numbers? y or n"); /* check if user want to enter another number */
scanf("%c", &newnum); /* read input */
if("%newnum == 'Y' || newnum == 'y')
{
printf("\n Enter the numbers you wish to average:\n"); /* enter new numbers if continue is true */
scanf("%d", &number[i]); /* read new numbers into array */
}
else
for(i = 0; i < count; i++) /* else display the value of the numbers entered into the array */
{
printf("%d", i+1); /* display the number of the array plus one to diplay sequenceto user */
scanf("The value you entered was %d", &number[i]); /* read numbers input into the array */
sum += number[i]; /* sum total of numbers inthe array */
}
average = (float)sum / count; /* average of sum of numbers divided by count of numbers */
for(i = 0; i < count; i++)
{
printf("\nThe Number %d was %d", i + 1, number[i]); /* display the number of the line and the corresponding value in the array */
printf("\n Average of the numbers entered is : %f\n", average); /* display the average of all numbers entered in the array */
printf("Would you like to continue? Y/N\n"); /*check if the user would like to enter a new set of numbers into the array */
scanf(" %c", &newnum); /* read input */
}
}while("%newnum == 'Y' || newnum == 'y'); /* if the user wants to continue, continue */
}
CODE TAGS added by Hammer