1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Sophie [7]
4 years ago
13

Task:create a struct that looks like:typedef struct person{ int age; double height;} Person;Create an array of Persons. Read dat

a for multiple persons from the keyboard. Stop when a negative age is found. Then find the average height, the average age, and the average ratio of age to height(age/height

Computers and Technology
1 answer:
Amiraneli [1.4K]4 years ago
6 0

Answer:

Check the explanation

Explanation:

person.c

#include <stdio.h>

#include <stdlib.h>

typedef struct person

{

  int age;

  double height;

}Person;

void getAverage(Person persons[], int max)

{

  int i, totAge=0;

  double avgAge = 0.0, avgHeight = 0.0, ratio=0.0, totHeight = 0;

  //calculate the Of age, height and the ratio Of to height(age/height):

  for(i=0;i<max;i++)

  {

      totAge = totAge + persons[i].age;

      totHeight = totHeight + persons[i].height;

  }

  //calculate the average

  avgAge = totAge/max;

  avgHeight = totHeight / max;

  ratio = avgAge / avgHeight;

  //output the results

  printf("\nthe average of age is: %lf", avgAge);

  printf("\nthe average of height is: %lf", avgHeight);

  printf("\nthe average ratio of age to height is: %lf", ratio);  

}

int main()

{

  //variables declaration

  int id=0;

  Person p[10];

  //read data from keyboard, which are the age and the height of person

  while(1)

  {

      printf("\nid: %d", id + 1);

      printf("\nplease enter the age: ");

      scanf("%d", &p[id].age);

      if(p[id].age < 0)

          break;

      printf("please enter the height: ");

      scanf("%lf", &p[id].height);

      id++;

  }      

  //call getAverage function

  getAverage(p, id);  

  return 0;

}

Kindly check the Screenshot and Output in the attached images below:

You might be interested in
If there are 10 routers between the source and destination hosts, how many transport processes will be involved on all devices?
Gnesinka [82]

Answer:

c. 2

Explanation:

As the routers are only involved with the process of finding the best route to reach an IP address (the destination hosts), they don't look at the IP Datagram payload (which includes the transport protocol header), only to IP header.

So, the only transport processes that "talk"each other, are the one on the source host (defining TCP or UDP source port/s, and the other  on the destination host (defining TCP or UDP destination port/s), so two applications (or more) in both machines can exchange data.

5 0
3 years ago
Which web design concept is most closely related to elements that symbolize the real world? A. node B. landmark c.metaphor IN D.
sergij07 [2.7K]

Answer:

landmark

Explanation:

6 0
3 years ago
Suponiendo que el centro de la gravedad de la barra se enchentra a 3 m del punto de apoyo,y su contrapeso, de 4800 N, se encuent
VikaD [51]

Answer:

C

Explanation:

because...

6 0
3 years ago
Manny has drafted an email message and configured a delivery option "Do not deliver before: 5:00 P.M. and today's date." He shut
erik [133]

In this scenario: C. the message will remain in Manny’s outbox until the computer is started and the Outlook program is started the next day.

<h3>What is Microsoft Outlook?</h3>

Microsoft Outlook simply refers to an e-mail and task management software application that is designed and developed by Microsoft Inc., so as to avail end users an ability to send electronic messages, schedule and plan their work activities on a timely basis.

Based on the time schedule, what would happen is that: C. the message will remain in Manny’s outbox until the computer is started and the Outlook program is started the next day.

Read more on Microsoft Outlook here: brainly.com/question/1538272

#SPJ1

7 0
2 years ago
What is the impact of using computer in office?​
yawa3891 [41]

Answer:

It significantly enhance productivity.It can increase the speed and accuracy of many work processes, which improves overall worker efficiency. Documents can be written and edited much more quickly with the aid of a word processing program, and procedures, such as billing and accounting, can also occur more rapidly and with fewer errors.Computers in the office increase productivity not only in areas such as word processing, data management and information access, but also in information creation, collation and ultimately storage.

8 0
3 years ago
Other questions:
  • One main advantage of CD-ROMs is that
    14·1 answer
  • One lap around a standard high-school running track is exactly 0.25 miles. Write a program that takes a number of miles as input
    5·2 answers
  • What is a bin range?
    14·1 answer
  • The length of the hypotenuse of a right-angled triangle is the square root of the sum of the squares of the other two sides. Wri
    7·1 answer
  • La tensión en Newtons necesaria para que una onda transversal cuya longitud de onda es​
    10·1 answer
  • The Monte Carlo method is commonly used to approximate areas or volumes of shapes. In this problem, we will use Monte Carlo to f
    12·1 answer
  • StreamPal is an audio-streaming application for mobile devices that allows users to listen to streaming music and connect with o
    6·1 answer
  • How can I restore tabs that just unexpectedly close out of nowhere ?
    6·1 answer
  • Jjgdg gegg tget t446v
    15·2 answers
  • What are the features of the title bar for the Microsoft word application?​
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!