This is the code:
#include <stdio.h>
int group, regular_group, regular_members, shutdown, special_group,
special_members;
float average_special, average_regular;
main()
{
do
{
printf("How many members are in the group?\n");
scanf("%d", &group);
if (group >= 15)
{
regular_group = regular_group + 1;
regular_members = regular_members + group;
printf("Do you want to add another group? yes = 1, no = 0 \n");
scanf("%d", &shutdown);
}
else
{
special_group = special_group + 1;
special_members = special_members + group;
printf("Do you want to add another group? yes = 1, no = 0 \n");
scanf("%d", &shutdown);
}
}
while (shutdown == 1);
average_regular = regular_members / regular_group;
average_special = special_members / special_group;
printf("\nTotal regular members:\n%d\n", regular_members);
printf("\nTotal special members:\n%d\n", special_members);
printf("\nAverage regular members in a group:\n%f\n", average_regular);
printf("\nAverage special members in a group:\n%f\n", average_special);
fflush(stdin);
getchar();
}
If a group is larger than 15 its automatically a regular group but if its less than its a special group. I need the total amount of memebrs of each catergory. The total amount of members is working fine. But I also need the average size of a group of both catergories. But the average is always 0,000000. But I cant find the error.. Please help me
Thank you very much !