Question: (TCOs 6 and 8) Write a C# function called CompareNumbers to compare two numbers and return a code that indicates their relationship: 0 if they

(TCOs 6 and 8) Write a C# function called CompareNumbers to compare two numbers and return a code that indicates their relationship: 0 if they are equal, 1 if the first number is larger, and -1 if the first number is smaller. Your main module should prompt the user for the two numbers and pass them to the function. The result is printed in your main module.
The output should look like this (note that it should work for any values that are input; these are just examples).
Enter a number: 10
Enter a number: 21
10 is smaller than 21

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 Databases Questions!