Few things, about your code:
>>void main(void)
main always returns int, so change it to int main() and then returns an value at the end of the program
>>total=total+salary;
Well, this is correct but don't work hard, you have the += operator, so total += salary is correct
>>count = count + 1;
same here you can an operator called ++, you can do this count++;
>>count = count -1;
same here you can use the -= operator, so you can do this count -= 1;
your program works even if total is set to zero, try it by yourself
Code:
#include<stdio.h>
#include<conio.h>
int main(void)
{
int count;
float salary, total, average;
count=0;
total=0;
salary=0;
printf("THIS PROGRAM ACCEPTS A NUMBER OF SALARIES");
printf("\nAND PRINTS THE AVERAGE SALARY TOGETHER");
printf("\nWITH HOW MANY SALARIES WERE ENTERED\n");
while( salary != -1)
{
printf("\nENTER SALARY:");
scanf("%f",&salary);
total += salary;
count++;
}
count = count -1;
average= total / count;
printf("\nNUMBER OF SALARIES ENTERED ARE: %d",count);
printf("\nAVERAGE SALARIES %5.2f",average);
getch();
return 0;
}
Also, try don't using conio.h it's not standard.