C# Creating and using Functions

后端 未结 11 682
暗喜
暗喜 2020-12-28 18:08

I need help with C# programming; I am new to it and I come from C background. I have a Console Application like this:

using System;
using System.Collections         


        
11条回答
  •  一整个雨季
    2020-12-28 18:33

    static void Main(string[] args)
        {
            Console.WriteLine("geef een leeftijd");
            int a = Convert.ToInt32(Console.ReadLine());
    
            Console.WriteLine("geef een leeftijd");
            int b = Convert.ToInt32(Console.ReadLine());
    
            int einde = Sum(a, b);
            Console.WriteLine(einde);
        }
        static int Sum(int x, int y)
        {
            int result = x + y;
            return result;
        }
    

提交回复
热议问题