Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program using C# This is an imcomplete code of a C# program which is supposed to accept any numbers of integers entered at the command

Program using C#

This is an imcomplete code of a C# program which is supposed to accept any numbers of integers entered at the command line and display their sum. When it is completed, the screen shows the use of 'cd', 'dir', and 'csc' commands, and the execution with output of this program with three integers, 100, 99, and -33. It can actually accept more input numbers, if you want. Because two lines in the given code are not completed, it cannot be compiled and executed. There is a line you must complete for a for-loop to work, and another line to fix so it displays the sum on screen.

using System;

class Assignment1

{

public static void Main(string[] myInput)

{

int i, sum = 0;

Console.WriteLine(" You entered " + myInput.Length + " numbers:");

//

// Problem (1) Fix next line to complete the header of making a for loop......

//

for ()

{

Console.Write(myInput[i] + " ");

sum = sum + Int32.Parse(myInput[i]);

}

//

// Problem (2) Fix next line so the actual sum is displayed......

//

Console.WriteLine(" Sum of your input numbers = ");

Console.WriteLine(" Good Bye!");

}

}

Example Output:

You Entered 3 Numbers: 100 99 -33

Sum of your input numbers = 166

Good Bye!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago