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
alexdok [17]
2 years ago
11

Write a program that include a method that returns the sum of all the elements of a Linked List of Integers. Allow the user to e

nter the integers to be added to your Linked List from the console (max of 10 integers). Test your program and display your integers and the sum results.
Computers and Technology
1 answer:
Illusion [34]2 years ago
8 0

Answer:

static void Main(string[] args)

       {

           //declare a blank linked list

           LinkedList<int> numList = new LinkedList<int>();

           Console.WriteLine("Enter the Numbers");

           //check if the size of the linkedlist is 10

           while(numList.Count < 10)

           {

               //read the input supplied by the user

               string val = Console.ReadLine();

               //check if the input is integer

               if(int.TryParse(val, out _) == false)

               {

                   //if not integer, display error message and prompt for new number

                   Console.WriteLine("Invalid number");

                   continue;

               }

               //add the inputted number to the linkedlist

               numList.AddLast(int.Parse(val));

               

           }

           //call the method for linkedlist sum and display it

           Console.WriteLine(SumLinkedList(numList));

           Console.Read();

       }

       //method for linkedlist summation

       private static int SumLinkedList(LinkedList<int> val)

       {

           //declare sum as zero

           int sum = 0;

           //loop through the linkedlist to display the num and sum all numbers

           foreach(int item in val)

           {

               Console.Write(item + " ");

               sum += item;

           }

           return sum;

       }

   }

Explanation:

program written with c#

You might be interested in
What are the five generations of computer software​
Lerok [7]

Answer:

1st gen: Vacuum Tubes(1940–1956)

2nd gen: Transistors(1956–1963)

3rd gen: Integrated Circuits: (1964–1971)

4th gen: Microprocessors (1971–PRESENT)

5th gen: Artificial Intelligence (present)

Explanation:

8 0
2 years ago
What is the capture of transaction and event information using technology to (1) process the information according to defined bu
Tanya [424]

Answer:

OLTP(Online transaction processing)  is the correct answer.

Explanation:

It is the database application that is used to catching the transection and that data or information which is related to the technology for the purpose of.

  • Process that data and information which is related to the following rules of the business or company.
  • It stores the data or information related to the online transaction.
  • It also helps to modify the current data or information for the new data or information.
6 0
3 years ago
Which of the following is the BEST solution to allow access to private resources from the internet?
notsponge [240]
FTP stands for file transfer protocol. FTP is used to transfer files between computers over the Internet. FTP servers can be setup to allow users to access the information anonymously or require registration for access.
7 0
3 years ago
Add me on fornite buddies Lynn_.25
Anna007 [38]

i- why would u ask that

Explanation:

6 0
2 years ago
Read 2 more answers
What do you think about Naruto?
Natalka [10]

Answer:

AMAZINGGG

Explanation:

because it just is !!

3 0
2 years ago
Read 2 more answers
Other questions:
  • Customer Premises Equipment (CPE) includes all devices connected to the PSTN, where the ownership and the responsibility for mai
    15·1 answer
  • Yesterday you installed a new game on your computer. When you ran the computer, you noticed that the application was running ver
    15·1 answer
  • What is Napoleon's friend's full name? From the Napoleon Dynamite movie.
    9·2 answers
  • Provide the instruction type, assembly language instruction, and binary representation of instruction described by the following
    7·1 answer
  • When two or more tables share the same number of columns, and when their corresponding columns share the same or compatible doma
    12·1 answer
  • A business letter is not written:
    6·1 answer
  • Please need help.... The system development process is called a cycle. Which of the following may be an ongoing process which su
    6·1 answer
  • What type of computer/device do you have i need it for a survey and it due today soooooooooooooo
    14·1 answer
  • 2. How does the internet give us the ability to communicate?
    15·1 answer
  • What is the duty of WHH? (white hat hackers)<br><br><br>ANY WHH HERE?<br>​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!