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
Help me or I'll go insane I've 6x already I'm about to lose it!!!!
Lemur [1.5K]
Two:
<span>Hiding the complexities of hardware from the user.
Managing between the hardware's resources which include the processors, memory, data storage and I/O devices.
Handling "interrupts" generated by the I/O controllers.
<span>Sharing of I/O between many programs using the CPU.

Three:
</span></span><span>Desktops
icons
menus
windows.</span><span>

Seven:
</span><span>The convention is that ellipses following a menu item usually means that the menu item will open a dialog box with further choices, rather than immediately carrying out an action.
</span>
Eight:
Organize Your Files

Nine:
Use the save as Command
name the File

Ten:
Open the file you want to delete
Select the file you want to delete
select Delete from the file menu
Confirm the deletion

Hope this helps
5 0
3 years ago
Read 2 more answers
What is the output of the following program?
Kamila [148]

Answer:

0

3

6

Explanation:

7 0
2 years ago
Business cards are generally designed so that this item stands out the most.
Sloan [31]
The D. Company Name most likely stands out on a business card with an address or such in smaller font below. A logo does nothing for a business card if a potential customer doesn't even know the name of the business. While logo's are often present on a business card, the company name is far more crucial to enunciate clearly which is of course, important for business's attraction of new customers.

So D. Company Name is my final answer!

Hope this helps! ;)
3 0
3 years ago
click attachment to see correct answer. Which agencies run the Landsat Program? The Landsat program is run by ___ and ___.​
Ksju [112]

Answer:

ancient times were nicr

Explanation:

5 0
2 years ago
Seth would like to make sure as many interested customers as possible are seeing his business’s website displayed in their searc
GenaCL600 [577]

Answer:

Hi! Make sure that the website has a few things. Proper Keywords, the pages have the proper tags, a form on the website, contact information, CIty State, Etc., Then a phone number. Social media icons that link properly to the social media pages.

Explanation:

5 0
3 years ago
Other questions:
  • Compare and contrast the following network types: Personal Area Network (PAN) Local Area Network (LAN) Metropolitan Area Network
    14·1 answer
  • Design a Geometry class with the following methods: A static method that accepts the radius of a circle and returns the area of
    15·1 answer
  • Implement a java program to find the smallest distance between two neighbouring numbers in an array.
    7·1 answer
  • When dealing with a person who is behaving violently you should argue with them. A. False B. True
    5·1 answer
  • If you want to open the Navigation pane to do a Find, what should you first click on the Home tab? Paragraph, Editing, Styles, o
    15·1 answer
  • Write an expression that computes the average of the values 12 and 40.
    6·1 answer
  • Describe the differences between program development and program execution, including the installed software required for develo
    5·1 answer
  • Suppose that f is a function with a prototype like this: void f(________ head_ptr); // Precondition: head_ptr is a head pointer
    6·1 answer
  • I need neveahbowe to see this.
    10·1 answer
  • Please help!!
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!