Answer to Question #320405 in C# for Donny

Question #320405

1. Create an application named Numbers whose main() method holds two integer variables. Assign

values to the variables. Pass both variables to methods named sum () and difference(). Create the

methods sum() and difference(); they compute the sum of and difference between the values of two

arguments, respectively. Each method should perform the appropriate computation and display the

results. Save the application as Numbers.cs


1
Expert's answer
2022-03-29T16:48:29-0400
 internal class Program
    {
        static void Main(string[] args)
        {
            int a = 10,
                b = 5;
            Console.Write($"First number: {a}");
            Console.Write($"Second number: {b}");
            Sum(a, b);
            Difference(a, b);
            Console.ReadKey();
        }
        public static void Sum(int a, int b)
        {
            Console.WriteLine($"{a} + {b} = {a + b}");
        }
        public static void Difference(int a, int b)
        {
            Console.WriteLine($"{a} - {b} = {a - b}");
        }
    }

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS