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
morpeh [17]
2 years ago
10

An athlete runs every day for five days. Write a program that computes the total distance and average distance ran by the athlet

e. The program should ask the user for the number of miles run on each day (Monday to Friday), and save the values entered by the user in five different variables. The program should first calculate the total miles ran by the athlete and store the result in a variable named sum. Then the program should compute the average distance covered and store it in a variable named average. Display the total distance and the average distance on the screen. Name your program file Hw1_q1_code.c.
Computers and Technology
1 answer:
Tamiku [17]2 years ago
5 0

Answer:

// here is Hw1_q1_code.c

#include <stdio.h>

// main function

int main(void) {

// variables

float dis_mon,dis_tue,dis_wed,dis_thu,dis_fri;

printf("enter distance ran by athlete on monday:");

// read distance on monday

scanf("%f",&dis_mon);

printf("enter distance ran by athlete on tuesday:");

// read distance on tuesday

scanf("%f",&dis_tue);

printf("enter distance ran by athlete on wednesday:");

// read distance on wednesday

scanf("%f",&dis_wed);

printf("enter distance ran by athlete on thursday:");

// read distance on thursday

scanf("%f",&dis_thu);

printf("enter distance ran by athlete on friday:");

// read distance on friday

scanf("%f",&dis_fri);

// total distance

float sum=dis_mon+dis_tue+dis_wed+dis_thu+dis_fri;

// average distance

float average=sum/5;

// print the total and average

printf("total distance ran by athlete is: %f miles",sum);

printf("\naverage distance ran each day is: %f miles",average);

return 0;

}

Explanation:

Declare five variables to store distance ran by athlete on each day from monday to friday.Read the five distance.Then calculate their sum and assign to variable "sum".Find the average distance ran by athlete by dividing sum with 5 and assign to variable "average".Then print the total distance ran and average distance on each day.

Output:

enter distance ran by athlete on monday:10                                                                                            

enter distance ran by athlete on tuesday:11                                                                                          

enter distance ran by athlete on wednesday:8                                                                                          

enter distance ran by athlete on thursday:9                                                                                          

enter distance ran by athlete on friday:12                                                                                            

total distance ran by athlete is: 50.000000 miles                                                                          

average distance ran each day is: 10.000000 miles

You might be interested in
When I try to add a module into a device, Packet Tracer pop-ups a warning message saying "Cannot add a module when the power is
laiz [17]

plug it into a charger the go to I tunes and it should be there


4 0
3 years ago
Wendy wants to learn how to write a computer program that can get the dimensions of a rectangle from the user and then tell the
otez555 [7]

Answer:

algorithms for finding the area

Explanation:

you need algorithms to find out any computer input information.

4 0
3 years ago
Read 2 more answers
Explain how abstraction is used in a GPS system?
zhenek [66]
I hope that this answer will help u to solve your problem. But u have tto take the importance clues only .

5 0
3 years ago
Alcoholism is a chronic disease caused by a dependency on alcohol. Which signs point to alcoholism?
trasher [3.6K]

Answer:

You might experience temporary blackouts and at times memory loss for the short term.

Sudden change in mood, and facing irritability signs

Coming up with excuses for drinking like relaxing, stress, feel normal or deal with stress

keeping distance from friends and various family members

Drinking away from all and in privacy

Suffering from hungover while you are not drinking

Changing group or acquaintances and appearance you usually are with previously

Explanation:

Please check the attachment.

3 0
3 years ago
Read 2 more answers
Suppose I define some structure type ( studentInfo), then I declare an instance of it and I decide to also create a pointer to t
Nookie1986 [14]

Answer:

a. (p*Main).age = 20;

Explanation:

Pointers use ->

where as normal variable use . to access its members

pMain is the pointer.

*pMain is the value inside pMain.

pMain->age = 20;

This statement equals to

(*pMain).age = 20;

Answer is option a.

8 0
2 years ago
Other questions:
  • Aubrey didnt like to use graphics or images on her slides. She preferred to use only a title for her slides and bullet-poinged t
    14·2 answers
  • A decrease in the Short-Run Aggregate Supply Curve is associated with what?
    8·1 answer
  • Which of the following are agricultural industry clusters? Human population systems, computer technoloy biotechnology or food pr
    9·1 answer
  • . A possible data for source that could be used when completing a mail merge could be a(n)… : *
    13·2 answers
  • What's the main idea??
    12·1 answer
  • Component of search engine that indexes web sites automatically. A search engine's __________, copies web page source code into
    12·1 answer
  • What Is the Purpose of a Web Browser? *<br><br>​
    7·2 answers
  • True or False The two types of general construction projects are residential for homes or dwellings and commercial for a commerc
    7·1 answer
  • Write a class Bug that models a bug moving along a horizontal line. The bug moves either to the right or left. Initially, the bu
    7·1 answer
  • Can someone please help me...pls.. how do u delete an account on this app(brainly)..pls help fast​
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!