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
frutty [35]
3 years ago
8

LAB:

Computers and Technology
1 answer:
Sergeu [11.5K]3 years ago
3 0

Answer:

Following is the program in the C language

#include <stdio.h> // header file  

int main() // main function

{

float weight1[10]; // array declaration  

float sum=0,max1,t; // variable declaration

for(int k = 0; k < 5; k++) //iterating the loop

{

printf("Enter weight %d: ",k+1);

scanf("%f",&weight1[k]); // Read the array by user

}

printf("\n");

printf("You entered: ");

max1=weight1[0];

for(int k = 0; k < 5 ; k++)

{

sum=sum+weight1[k];

if(max1 < weight1[k]) // check condition for highest element

{

max1=weight1[k];

}

printf("%.2lf ",weight1[k]);

}

t=sum/5.0; // find average

printf("\nTotal weight: %.2lf\n",sum); // displat total

printf("Average weight: %.2lf\n",t); // display Average

printf("Max weight: %.2lf\n",max1); // display maximum value

return 0;

}

Output:

Enter weight 1: 1

Enter weight 2: 2

Enter weight 3:3

Enter weight 4:4

Enter weight 5: 5

You entered:  1.00  2.00  3.00  4.00  5.00

Total weight: 15.00

Average weight:  3.00

Max weight:  5.00

Explanation:

Following are description of program :

  • Declared a array "weight1" of type "float" .
  • Declared a variable sum,t max1 of type "float ".
  • Iterating the loop for taking the input by the user by using scanf statement .
  • Iterating the loop for calculating the maximum value in "max1" variable  ,total in "sum" variable .
  • In the "t" variable we calculated the average.
  • Finally we print the value of the maximum ,average ,total and respective array that are mention in the question .

You might be interested in
A cell's address, its position in the workbook, is referred to as a ________________ when it is used in a formula.
Inga [223]

Answer:

A cell's address, its position in the workbook, is referred to as a <u>cell reference</u>  when it is used in a formula.

5 0
3 years ago
Please Help meeeeeeeeeee:
Akimi4 [234]

Answer:

D) save as

Explanation:

If you press save as it'll give you the option where to save to.

6 0
3 years ago
Read 2 more answers
What is the processing speed for the second generation of computers​
Helga [31]

10mbp

I hope it helps you

5 0
3 years ago
Write a little man program that accepts three values as input and produces the largest of the three as output.
ki77a [65]
Required: program to return the largest of three numbers.

pseudocode

input parameters, int A,B,C;
int T; // temporary storage
if (A>B) T=A;
else T=B;
if (T>C) print(T);
else print(C);


5 0
3 years ago
Which partitioning method must you use for a 4-tb hard drive?
kogti [31]
Convert the MBR to GPT disk is a way to solve the problem.
4 0
3 years ago
Other questions:
  • How many fonts are there in a theme?<br> A. 1<br> B. 2<br> C. 4<br> D. 5
    10·1 answer
  • eplace the underlines with the words in parentheses that follow: The ____ solves the ____ of a ____ by expressing an ____ in a _
    5·1 answer
  • The type of human hair wig that is the most costly is:
    12·1 answer
  • Write a program that reads in the following data, all entered on one line with at least one space separating them: a) an integer
    13·1 answer
  • By default, after how much time has elapsed in a client's DHCP lease will the client attempt to renew the lease?
    12·1 answer
  • Write a program that computes the minimum, maximum, average and standard deviation of the population over time for a borough (en
    6·1 answer
  • Does Brainly have tutors?
    11·1 answer
  • Describe what each of the following functions in R do.1. t2. matplot3. c4. seq5. legend6. matrix7. rownames8. colnames9. type of
    14·1 answer
  • In the negative side of the battery, there are millions and millions of _________.
    14·1 answer
  • Sự ra đời của thương mại điện tử có tác động như thế nào đến việc quảng cáo và Marketing sản phẩm
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!