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
Write a program (C++) that reads a number between 1,000 and999,999 from the user where the user enters a comma in the input.Then
mr Goodwill [35]

<u>C++ program to print the digit without a comma </u>

#include<iostream>

#include<string>

using namespace std;

void commaremoval(string num)  /*Defining function commaremoval with parameter num of string type*/

{  

string  s=num;

for(int i=0; i< s.length();i++)

   {

    if(s[i]!=',') /*Checking whether the string doesn't contain ' ,' */

       cout<<s[i];  //Printing Output without comma

   }  

}

//driver function

int main()

{

string num;

cout<<"Enter a digit between 1,000 and 999,999:"<<endl; /*taking input from user*/

cin>>num;

commaremoval(num); //calling function

return 0;

}

<u>Output</u>

Enter a digit between 1,000 and 999,999:  22,343

22343

7 0
3 years ago
What is a characteristic of high-level computer programming languages?
Zinaida [17]

Answer:

1.The high level language are closer to human language the instruction written in this language are similar to English like words and statements

2. It is easy to understand

3. It is easy to modify

4. User friendly

5. Standarized syntax

6. Deep hardware knowledge is not required for using this.

7. Mechine indepence

8. In this language the error are easily located.

9. The program written in this language are called source code.

10. The program written in this language are shorter in size than low level language.

3 0
4 years ago
If you feel that an OSHA inspection is needed to get hazards corrected at your workplace, which is your best option?
KATRIN_1 [288]
Most likely bring it to your managers attention and and have him contact an OSHA employee.
4 0
4 years ago
WHERE DO I GO TO DO THIS AND WHAT DO I WRITE?????
faust18 [17]

You can just look up "python ide online" on google and paste this code:

n = -1

count = 0

while n < 0:

   n = int(input("We're checking to see if a number is prime or not! Enter a positive number: "))

if n % 2 == 0:

   if n == 2:

       print("{} is a prime number".format(n))

   else:

       print("{} is not a prime number".format(n))

else:

   for x in range(n, 1, -1):

       if n % x == 0:

           count += 1

   if count > 1 or n == 1:

       print("{} is not a prime number".format(n))

   else:

       print("{} is a prime number".format(n))

I've written some code that checks to see if a number entered by the user is a prime number or not.

Sorry, but I'm not too good with pseudocode plans and all that. I hope this helps.

8 0
3 years ago
Read 2 more answers
Whats is a better game?
Jobisdone [24]

Answer:

The first two are the best ones I see here, because I play them. Not sure how else to say that. Please make sure to also use brainly for school, though. Thanks!

3 0
2 years ago
Other questions:
  • Which is the main function of the arithmetic and logic unit (ALU)?
    5·2 answers
  • answer for brainliest Today, trending current events are often present on websites. Which of the following early developments in
    15·1 answer
  • In a speech at a research conference, a computer expert stated that shopping centers would become obsolete in the future. He bel
    8·1 answer
  • A developer needs to create a visualforce page that displays case data. The page will be used by both support reps and support m
    10·1 answer
  • Social media is an effective form of e-commerce. True False
    12·1 answer
  • How can your microsoft word processing skills affect overall writing skills on the job?<br><br>​
    7·1 answer
  • Whats the best way to get into a computers programming to get past firewalls
    15·2 answers
  • Which element is represented by the electron configuration in example B? Example B: 1s22s22p63s23p64s1 Aluminum Cesium Potassium
    12·2 answers
  • Zoe wants to use an image file that will allow her to preserve all of the original
    10·1 answer
  • It would be at least two decades before some of
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!