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
Pressing and holding _______ while clicking enables you to select multiple contiguous files or folders.
liq [111]

Answer:

Hi LizBiz! The answer is Ctrl key on Windows, or Command key for Mac.

Explanation:

The Ctrl (Windows) key or equivalent Command key on Mac has a special purpose which allows special operations to be performed when combined with another action, such as clicking on multiple pictures or files for selection.

8 0
3 years ago
Where should the VPN concentrator be installed?
zmey [24]
C, using a firewall make sures no viruses enter your device while setting up the vpn
7 0
2 years ago
Read 2 more answers
Your license can be revoked if you’re found guilty or not stopping to give when the vehicle you were driving is involved in a cr
BigorU [14]
Causing a death or personal injury
5 0
3 years ago
Write a program that draws an 8 8 chess board, with alternating gray and white squares. You can use the SetTextColor and Gotoxy
Kitty [74]

Using the knowledge in computational language in C code it is possible to write a customized chess code.

<h3>Writting the C code as:</h3>

<em>Wait      PROTO</em>

<em>Write     PROTO</em>

<em>CrLf          PROTO</em>

<em>Delay         PROTO</em>

<em>Clrscr        PROTO</em>

<em> PROTO times:byte, color:dword</em>

<em>PROTO times:byte, color:dword</em>

<em>ROTO color:dword</em>

<em> PROTO color:dword</em>

<em>UpdateColor   PROTO</em>

See more about C code at brainly.com/question/15301012

#SPJ1

7 0
2 years ago
Loa (speaker) thuộc nhóm thiết bị nào ?
dlinn [17]

Answer:

this say's "Which device group?" hope i helpped

8 0
3 years ago
Other questions:
  • In designing input by clinicians for an EHR system, which of the following would be effective for a clinician when the data are
    15·1 answer
  • Netflix suggestions ?
    15·2 answers
  • What type of document is a mobile device's EULA?
    13·1 answer
  • A result of the Gibbons v. Ogden (1824) decision was that states​
    11·1 answer
  • Fortnite anyone? i just started tdy so dont be judgiee lol
    6·2 answers
  • Who was the first president
    6·2 answers
  • Which key(s) will launch the Spelling Checker dialog box? F8 F7 Ctrl+H F2
    11·2 answers
  • Consider the following method, remDups, which is intended to remove duplicate consecutive elements from nums, an ArrayList of in
    7·1 answer
  • All _______ that store more than one piece of data ​
    12·1 answer
  • What are the components of computer system??<br>​
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!