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
Is backing up computer files done on the hard drive?
melomori [17]
Yes I believe so 

It should be acked up on the hard drive
7 0
3 years ago
What level of system and network configuration is required for cui?
andrey2020 [161]

The level of system and network configuration is required for Cui will be "Moderate confidentiality".

  • The data that really should be safeguarded or disseminated under appropriate regulations, rules, and conservative government objectives or guidelines, would be considered as CUI.
  • The FISMA demands CUI Fundamental to somehow be safeguarded somewhere at the FISMA Conservative category and may even be labeled as CUI as well as regulated.

Thus the above answer is right.

Learn more:

brainly.com/question/14083709

4 0
2 years ago
What is the difference between the animation with shape hints and the animation without the shape hints?
soldier1979 [14.2K]
Animation with shape is 3D animation
Animation without shape is 2D animation
4 0
3 years ago
When working with tables, if I wanted odd and even rows to be formatted differently, I would select the ___ option from the Tabl
coldgirl [10]
I would say that It is the Banded rows option.
8 0
3 years ago
Write a SELECT statement that returns these columns from the Products table: The list_price column The discount_percent column A
MA_775_DIABLO [31]

Answer:

SELECT  

   list_price,

   discount_percent,

   ROUND(list_price * discount_percent / 100,2) AS discount_amount

FROM

   Products;

Explanation:

6 0
2 years ago
Other questions:
  • I don’t know technically
    9·2 answers
  • What do developers do to support software products
    14·1 answer
  • Which of the following does not use a Graphic User Interface?
    14·1 answer
  • Random Access Memory is tempory computer memory that stores works in progress
    7·1 answer
  • A domain name is used to: *
    15·1 answer
  • How do you resolve conflicts in your life??
    11·1 answer
  • Anyone trying to play fortnite ? im bored lol
    6·2 answers
  • Is monitor is a television​
    5·2 answers
  • If you do not clean your hardware on a regular basis, which of these is most likely to be a problem?
    11·1 answer
  • How does the number of jobs in internet media compare to the number of jobs in tv broadcasting and print media?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!