Question: Hello, my assignment has asked me to: Write application that asks the user to enter two integers and displays The two numbers you enteredare:, followed

Hello, my assignment has asked me to:

Write application that asks the user to enter two integers and displays "The two numbers you enteredare:", followed by the two numbers on the screen.

Next , determine the sum,difference (result of first number minus the second number), product,and quotient (result of first number divided by the second number), and modulus (remainder of the first number divided by the second number) and print these values to the screen.

Finally, determine the larger of the two integers, and print to the screen "The larger of the two numbers is:", followed by the larger integer.If the two numbers are equal, print "The two numbers are equal."

The code is in C# and it is Console. Please see this is the code I have written, but I cannot get the code to execute passed the request to enter the first number. I have been working on this for a couple days now. Please help me correct my code so I can see what I have done wrong?

namespace Assignment1

{

class Program

{

static void Main(string[] args)

{

string firstString, secondString;

int first, second, sum, difference, product, quotient, modulus;

Console.Write("Enter the first number: ");

firstString = Console.ReadLine();

first = Convert.ToInt32(firstString);

Console.Write("Enter the second number: ");

secondString = Console.ReadLine();

second = Convert.ToInt32(secondString);

sum = first + second;

Console.WriteLine("The sume of {1} and{2} is {3}",

first, second, sum);

difference = first - second;

Console.WriteLine("The difference of {1} and {2} is {3}",

first, second, difference);

product = first* second;

Console.WriteLine("The product of {1} and {2} is {3}",

first, second, product);

quotient = first / second;

Console.WriteLine("The quotient of {1} and {2} is {3}",

first, second, quotient);

Modulus = first % second;

Console.WriteLine("The remainder of {1} and {2} is {3}",

first, second, remainder);

if (first > second)

Console.WriteLine("{1} is greater than {2}",

first, second);

else

Console.WriteLine("{1} is not greater than {2}",

first, second);

Console.WriteLine("Press the [enter] key to continue: ");

Console.ReadLine();

}

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!