Using WHILE, find the average age of each man and woman (beginner)

Asked 1 weeks ago, Updated 1 weeks ago, 2 views

How can I get the average age of each man and woman by receiving data from 20 users using the WHILE statement? I'll get the average age, but it's hard because I have to average it by gender.

#include <stdio.h>

int main()
    int num,input;
    int i=0;
    int total=0;

        printf("Enter your age");
    printf ("age average: %d", total/num);


2022-09-20 15:54

1 Answers

I'll give you just this much hint. You'll be able to do it yourself.

int girl_count, girl_age;
int boy_count, boy_age;
int sex, age;
int total = 0;
int i = 0;

2022-09-20 15:54

If you have any answers or tips

© 2022 pinfo. All rights reserved.