Step-by-step explanation:
#include <stdio.h>
main(){
int x,c=0,sum=0;
float a;
printf("enter a number (don't enter -1)\\");
scanf("%d",&x);
while(x!=-1){
c++;
sum+=x;
printf("enter a number(enter -1 to calculate the average)\\");
scanf("%d",&x);
}
a=float(sum)/c;
printf("the average is %.2f ",a);
}