- Course
 - Functions A
 - Function returning a value
 
 
 
                    
                        
Function returning a value
                    
                    
                    
                        Last updated: 
                            8/23/2020
                        
                      
                        
                            ⁃
                            Difficulty: 
                            Easy
                        
                    
           
                    Create a C# program that implements a function called Add that returns the sum of two whole numbers passed by parameter. Then you must execute the function from the Main of the program. 
                    
                    Input
                    
                    4
4
                    
                    Output
                    
                    8
                    Solution
                    
                   
                    
                    using System;
public class FunctionReturnValue
{
    public static void Main(string[] args)
    {
        int x = Convert.ToInt32(Console.ReadLine());
        int y = Convert.ToInt32(Console.ReadLine());
        int sum = Sum(x, y);
        Console.WriteLine(sum);
    }
    public static int Sum(int x, int y)
    {
        return x + y;
    }
}