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]
3 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]3 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
The graph of which function has an axis of symmetry at x=-1/4​
yuradex [85]

Answer:

axis of symmetry is the x value of the vertex

for

y=ax^2+bx+c

x value of vertex=-b/2a

first one

-1/2(2)=-1/4

wow, that is right

answer is first one

f(x)=2x^2+x-1

Explanation:

3 0
3 years ago
Select the correct text in the passage.
Rasek [7]

Answer: To charge his camera, he uses any available charge

Explanation: This is the answer as having a charge ready at any time can be helpful.

5 0
2 years ago
Gina is driving her car down the street. She has a teddy bear sitting on the back seat. A dog runs in front of Gina's car, so sh
kiruha [24]
Newton's 1st Law of Motion- an object (bear) will stay in motion until acted upon by an unbalanced force
5 0
3 years ago
Read 2 more answers
While researching 19th-century American history online for homework, Rowan gets distracted by other articles about American lite
klemol [59]

Answer:

a gain of knowledge

Explanation:

she is expanding her current knowledge

6 0
2 years ago
Read 2 more answers
Giving brainlist to whoever answer this!! what is a typographic style?
zaharov [31]

The Elements of Typographic Style is the authoritative book on typography and style by Canadian typographer, poet and translator Robert Bringhurst. Originally published in 1992 by Hartley & Marks Publishers, it was revised in 1996, 2001 (v2. 4), 2002 (v2. 5), 2004 (v3).

5 0
3 years ago
Read 2 more answers
Other questions:
  • Write one DDL statement to add a new table Project into exam1. It contains the followingthree columns:-ProjNum of char(3) type,
    15·1 answer
  • A company ABC asked you to design a simple payroll program that calculates and employee's weekly gross pay, including any overti
    9·1 answer
  • Explain how applying different network topologies could have an impact on the security of a network
    11·1 answer
  • A friend of yours is having trouble getting good Internet service. He says his house is too remote for cable TV—he doesn’t even
    11·1 answer
  • Technologies that function within the established system are called
    12·1 answer
  • What is the Java source filename extension? What is the Java bytecode filename extension?
    14·1 answer
  • What are the basic features of Usenet group
    15·1 answer
  • Given the IPv4 address, 200.245.10.150/28, how many subnets are possible and how many hosts can be supported by each subnet?
    15·1 answer
  • Which statement best describes what a project manager controls
    8·2 answers
  • Prior to the 1996 NEC, ____ receptacles and cords were permitted. However, now it is mandatory that a separate equipment groundi
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!