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
6. Which of the following is malware? (1 point)
marusya05 [52]
Software to damage computers
5 0
3 years ago
Read 2 more answers
Algorithm and flowchart:- find the product of two number (a and b)​
Korvikt [17]

Answer:

i have no idea a i guess

Explanation:

5 0
2 years ago
A _________, such as apple.com and whitehouse.gov, uniquely identifies a site and a brand on the web.
Serga [27]

A <u>domain name </u>such as apple.com and whitehouse.gov, uniquely identifies a site and a brand on the web.

What is Domain name?

This is known to be a kind of Application programming interface. The  domain name is said to be a series or a string of letters that tells more about a realm of administrative autonomy.

It  tells about authority as well as control that is found  within the Internet. Domain names are said to be used in a lot of networking contexts and therefore, A <u>domain name </u>such as apple.com and whitehouse.gov, uniquely identifies a site and a brand on the web.

Learn more about Domain name from

brainly.com/question/13153286
#SPJ1

5 0
1 year ago
If you play video games, please answer these questions it’s for a survey for my game development class!!
yarga [219]

Answer:

Doom, fortnlte, mlnecraft, ark survival evolved, ark survival of the fittest, terraria, raft, among us, ect.

First person shooters, Third person shooters, Creative games

8-10 years

More VR, better graphics, more realistic

Maybe, not anytime soon.

Explanation:

5 0
2 years ago
Select the correct answer from the drop-down menu.
Eva8 [605]

Answer:

1. diagraph

2.analog

maybe

3 0
2 years ago
Other questions:
  • Template files can contain the following items: text, tables, images and lists.
    10·1 answer
  • Question 2 of 5
    8·1 answer
  • How to get out of compatibility mode in word?
    15·1 answer
  • What typically happens by default when a file is double clicked in Microsoft Windows?
    9·1 answer
  • Which of the following lists the proper order of the categories of the SOC system from general to specific?
    11·1 answer
  • What is a written or electronic document that outlines etiquette policies for using networks and network resources?
    8·1 answer
  • Assume that a 5 element array of type string named boroughs has been declared and initialized. Write the code necessary to switc
    5·1 answer
  • Pls tell me the answer pls i need the answer
    6·2 answers
  • Open the NetBeans IDE and create a new project named MySizes.java. Your program should do the following:
    9·1 answer
  • processing C. have only one function, e.g. control traffic lights in a town, games machines 7 To create a formula, you first: A.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!