Question

C# Visual Studios HelloWorld For this program, you will need to sum the values of an...

C# Visual Studios HelloWorld

For this program, you will need to sum the values of an array and print the sum. A numbers array of integers will be provided for you in the program file. Since the array will already be populated with values, all your program needs to do is calculate the sum of all the values and print the output.

Sample output

Sum: 215
0 0
Add a comment Improve this question Transcribed image text
Answer #1

#source code:

using System;
class HelloWorld {
static void Main() {
int[] data={50,30,30,5,50,50};
int t=0;
for(int i=0;i<data.Length;i++){
t=t+data[i];
}
Console.WriteLine(t);
}
}

#source code along with output:

main.cs 1 using System; 2. class HelloWorld { 3 static void Main() { int[] data={50,30,30,5,50,50}; int t=0; 6 for(int i=0;i<

#if you have any doubt or more information needed comment below..i will respond as possible as soon..thanks..

Add a comment
Know the answer?
Add Answer to:
C# Visual Studios HelloWorld For this program, you will need to sum the values of an...
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
  • C# Visual Studios HelloWorld For this assignment, you'll work with first creating an array and populating...

    C# Visual Studios HelloWorld For this assignment, you'll work with first creating an array and populating it's values. Then, we'll use the values in the array to calculate the average. Since it's common for an average to result in numbers with decimal points, the array you create should be of type double[]. This program will need to use dynamic input from the user so perform the following steps: Ask the user how many numbers need to be added. Use this...

  • C# Visual Studios HelloWorld For this assignment, you'll be given two arrays where one represents the...

    C# Visual Studios HelloWorld For this assignment, you'll be given two arrays where one represents the item numbers and the other array represents the price of the item. For instance, index 3 in the items array will have the corresponding price for the item in index 3 of the price array. You'll ask the user which item to lookup, search the array for the item, and print the price when the item is found. When the item was not found,...

  • Include the blackbox output done with C# microsoft visual studios software. write a C# program to...

    Include the blackbox output done with C# microsoft visual studios software. write a C# program to sort a parallel array that consists of customer names and customer phone numbers. The solution should be in ascending order of customer names. For instance, if the input is string[] custNames- { "ccc", "ddd", "aaa", "bbb" }; stringl] custIds687-3333", "456-4444", "789-1111", "234-2222" ; then, the solution is string[] string[] custNames- { "aaa", "bbb", "ccc", "ddd" }; custIds"789-1111", "234-2222", "687-3333", "456-4444"]; There are some restrictions:...

  • Write a program using C in Microsoft visual studios. Write a function that receives an array...

    Write a program using C in Microsoft visual studios. Write a function that receives an array of integers and the array length and prints one integer per line (Hint: Use \n for a line break). Left align all of the integers and use a field width of 10. Populate an array of 10 elements from the user and pass the array and its length to the function.

  • Must be done in C++ 2013 microsoft visual studio Write a program that creates a 4...

    Must be done in C++ 2013 microsoft visual studio Write a program that creates a 4 x 5 two-dimensional array. The program should use loops to populate the array using the rand, srand and time functions with random numbers between 10 and 60. After the values have populated the array, output the values of the array to the screen in something that looks like a 4 x 5 table.

  • C++ 3. Write a program that reads integers from a file, sums the values and calculates...

    C++ 3. Write a program that reads integers from a file, sums the values and calculates the average. a. Write a value-returning function that opens an input file named in File txt. You may "hard-code" the file name, i.e., you do not need to ask the user for the file name. The function should check the file state of the input file and return a value indicating success or failure. Main should check the returned value and if the file...

  • C++ Visual Studios Program - Simple The program must use a Vector. Topic: Carl's Cab Stand...

    C++ Visual Studios Program - Simple The program must use a Vector. Topic: Carl's Cab Stand needs a program to keep track of their daily clients. Your program shall allow the user to enter 10 names. You will then retrieve the names, one by one, from the data structure (using the appropriate method of retrieval for each data structure) and present them on-screen so that Carl knows who to service next. Include a printed line at the end of the...

  • Use c++ as programming language. The file needs to be created ourselves (ARRAYS) Write a program...

    Use c++ as programming language. The file needs to be created ourselves (ARRAYS) Write a program that contains the following functions: 1. A function to read integer values into a one-dimensional array of size N. 2. A function to sort a one-dimensional array of size N of integers in descending order. 3. A function to find and output the average of the values in a one dimensional array of size N of integers. 4. A function to output a one-dimensional...

  • **IN C*** * In this lab, you will write a program with three recursive functions you...

    **IN C*** * In this lab, you will write a program with three recursive functions you will call in your main. For the purposes of this lab, keep all functions in a single source file: main.c Here are the three functions you will write. For each function, the output example is for this array: int array[ ] = { 35, 25, 20, 15, 10 }; • Function 1: This function is named printReverse(). It takes in an array of integers...

  • I am in C++ programming, I need help with this assignments. The answer in this assignments...

    I am in C++ programming, I need help with this assignments. The answer in this assignments when I look for it it doesn't work in my visual studios. Can you please help me? I hardly have C in the class, if I fail I will fail the whole class and repeat this class again.   The file named Random.txt contains a long list of random numbers. Download the file to your system, then write a program that opens the file, reads...

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