Question

Programming logic C# visual studio. Please paste the code with the screenshot. Compute the average of...

Programming logic C# visual studio.

Please paste the code with the screenshot.

  1. Compute the average of the elements of the given array and then output the average.

int[] numbers = new int[10];

Add these numbers to the array

87, 68, 94, 100 , 83, 78, 85, 91, 76, 87

The output should be like this:

The average is ……

0 0
Add a comment Improve this question Transcribed image text
Answer #1
using System;

namespace Practice
{
    public class ArrayAverage
    {
        public static void Main(string[] args)
        {
            int[] numbers = new int[10];
            numbers[0] = 87;
            numbers[1] = 68;
            numbers[2] = 94;
            numbers[3] = 100;
            numbers[4] = 83;
            numbers[5] = 78;
            numbers[6] = 85;
            numbers[7] = 91;
            numbers[8] = 76;
            numbers[9] = 87;

            double total = 0;
            for (int i = 0; i < numbers.Length; i++)
            {
                total += numbers[i];
            }

            total /= numbers.Length;
            Console.WriteLine("The average is " + total);
        }
    }
}

The average is 84.9 Process fini shed with exit code o

Add a comment
Know the answer?
Add Answer to:
Programming logic C# visual studio. Please paste the code with the screenshot. Compute the average of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • programming logic C# visual studio. Add a class called Car (Leave Program.cs as-is).

    programming logic C# visual studio. Add a class called Car (Leave Program.cs as-is).

  • programming logic C# visual studio Use an if…else-if…else statement to output the following based on an...

    programming logic C# visual studio Use an if…else-if…else statement to output the following based on an int time entered in military time (ie. 23 == 11:00 p.m., 11 == 11:00 a.m.). You will need to use a ReadLine() and then convert the input to an int value. Based on the input, output the following messages: Input          Output 0-11            Good Morning 12-16          Good Afternoon > 16            Good Evening

  • I need to develop the 7 functions below into the main program that's given on top...

    I need to develop the 7 functions below into the main program that's given on top Write a C program to create array, with random numbers and perform operations show below. Il Project 3 (53-20). 1 Projects CS5,00 This file contains the function Programcution Dagine and one include <timo // Defining some constants definer_SIZE 20 define LOVE LIMIT 1 eine UPR UNIT define TALSE eine Tut 1 wold randomizery (int[], int, Int, int) wold pinay in. St, Int); En find...

  • C++ programming. Please provide copy/paste code and a screenshot of the code being ran in the...

    C++ programming. Please provide copy/paste code and a screenshot of the code being ran in the compiler. Write a program that takes two rectangle objects and then adds them and returns the final rectangle object. You are required to overload the addition operator to add the two objects.

  • Consider the below matrixA, which you can copy and paste directly into Matlab.

    Problem #1: Consider the below matrix A, which you can copy and paste directly into Matlab. The matrix contains 3 columns. The first column consists of Test #1 marks, the second column is Test # 2 marks, and the third column is final exam marks for a large linear algebra course. Each row represents a particular student.A = [36 45 75 81 59 73 77 73 73 65 72 78 65 55 83 73 57 78 84 31 60 83...

  • Write a program to calculate students’ average test scores and their grades. You may assume the...

    Write a program to calculate students’ average test scores and their grades. You may assume the following data: Johnson 85 83 77 91 76 Aniston 80 90 95 93 48 Cooper 78 81 11 90 73 Gupta 92 83 30 69 87 Blair 23 45 96 38 59 Clark 60 85 45 39 67 Kennedy 77 31 52 74 83 Bronson 93 94 89 77 97 Sunny 79 85 28 93 82 Smith 85 72 49 75 63 Use three...

  • Write a program to calculate students’ average test scores and their grades. You may assume the...

    Write a program to calculate students’ average test scores and their grades. You may assume the following data: Johnson 85 83 77 91 76 Aniston 80 90 95 93 48 Cooper 78 81 11 90 73 Gupta 92 83 30 69 87 Blair 23 45 96 38 59 Clark 60 85 45 39 67 Kennedy 77 31 52 74 83 Bronson 93 94 89 77 97 Sunny 79 85 28 93 82 Smith 85 72 49 75 63 Use three...

  • Student average array program

    Having a bit of trouble in my c++ class, was wondering if anyone can help.Write a program to calculate students' average test scores and their grades. You may assume the following input data:Johnson 85 83 77 91 76Aniston 80 90 95 93 48Cooper 78 81 11 90 73Gupta 92 83 30 68 87Blair 23 45 96 38 59Clark 60 85 45 39 67Kennedy 77 31 52 74 83Bronson 93 94 89 77 97Sunny 79 85 28 93 82Smith 85 72...

  • C++ programming. Please provide copy/paste code and a screenshot of the code being ran in the...

    C++ programming. Please provide copy/paste code and a screenshot of the code being ran in the compiler. Vertebrates are the types of animals that typically have backbones with a bony skeleton and a brain. Vertebrates can be mammals, reptiles, amphibians, fish, and birds. Based on this information, do the following: Create a C++ hierarchy of the vertebrates class along with the attributes (variables) and behaviors (functions) using C++ syntax. Is this an example of single inheritance or multiple inheritance? Why...

  • (C++ Microsoft Visual Studio) [15 Points] Write a while loop to calculate the average of numbers...

    (C++ Microsoft Visual Studio) [15 Points] Write a while loop to calculate the average of numbers entered by the user:  Ask the user to enter an integer number or -1 to stop  Add the entered numbers  Compute the average of the numbers outside the loop after termination  Print the average

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT