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
KengaRu [80]
3 years ago
5

Write a C program to show sum of 10 elements of array and show the average.

Computers and Technology
1 answer:
ipn [44]3 years ago
8 0

Answer:

// C program to find sum and average of 10 elements.

#include <stdio.h>

// main function

int main(void) {

   // array

double arr[10];

// variables

double average,sum=0;

int i;

   // ask to enter 10 elements of the array

printf("Enter 10 elements of the array:");

for(i=0;i<10;i++)

{

    // read elements of the array

    scanf("%lf", &arr[i]);

    // calculate the sum of elements

    sum=sum+arr[i];

}

// fint the average

average=sum/10;

// print sum

printf("Sum of 10 elements of the array is:%f ",sum);

// print average

printf("\nAverage of 10 elements of the array is:%f ",average);

return 0;

}

Explanation:

Create an array of size 10.Then read 10 values from user and store them into  array.Find the sum of 10 elements of the array and assign it to variable "sum". Find the average by dividing sum with 10.Print the sum and average.

Output:

Enter 10 elements of the array:3 2 4 5 1 4 8 9 12 10                                                                      

Sum of 10 elements of the array is:58.000000

Average of 10 elements of the array is:5.800000

You might be interested in
Who was the father of computer​
masya89 [10]

Answer:

elon musk

Explanation:

8 0
3 years ago
Write a program that reads a list of integers, and outputs whether the list contains all even numbers, odd numbers, or neither.
astraxan [27]

Answer:

uuuuu

Explanation:

8 0
2 years ago
Read 2 more answers
lance measured 0.485 liter of water. Angel measured 0.5 liter of water. lance said, "My beaker has more water than yours because
nikdorinn [45]
No, if we were to make the decimal for angel it would be 0.500 which is more than lance, you can also round them
4 0
4 years ago
Read 2 more answers
In a word processor, Tariq chooses Options from the Tools menu and then selects the Track Changes tab. Which of the following ta
bearhunter [10]

Highlight Changes

Compare Documents

3 0
4 years ago
Catering question<br> What is the hottest food in the world
Elza [17]
The hottest food in the world is a Ghost Pepper. It is 400 times hotter than Tabasco sauce. It was 1 million SHU's! Hope this helps! ^0^

The correct answer is: Ghost Peppers
7 0
4 years ago
Other questions:
  • Why would an over the shoulder shot be used
    11·1 answer
  • _____ allow(s) a user to double click with the mouse in a document to move the insertion point to a new location.
    11·1 answer
  • Write and run a Python program that asks the user for a temperature in Celsius and converts and outputs the temperature in Fahre
    10·1 answer
  • WILL GIVE BRAINLIEST TO FIRST AND BEST ANSWER!
    10·1 answer
  • The main devices in a rectifier are:
    14·2 answers
  • Fill in the blanks with given words:{system unit / desktop / laptop / tablet / smartphone}1. A _____ can be as powerful as a des
    11·1 answer
  • For this assignment, you will write a program that calculates gross and net revenue for a movie theater. Consider the following
    15·1 answer
  • The names of the governing body or organizationds that creates rules for information technology and information communication te
    9·1 answer
  • Which of the following is NOT one of the four benefits of using email?
    14·1 answer
  • How can I call moderator in braily app ???
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!