Mal Coppo

Mal Coppo

  • NA
  • 16
  • 1.4k

c# question how do i pass variables to the main, while in cl

May 10 2018 4:55 AM
using System;
public class Program
{
public void CalculateArea(int Height, int Base, int Area) //function header
{
Console.Write("Enter Height: ");
Height = int.Parse(Console.ReadLine());
Console.Write("Enter Base: ");
Base = int.Parse(Console.ReadLine());
Area = Height * Base / 2;
Console.WriteLine("Area of Triangle = {0}", Area);
}
public void Validation(int Height, int Base, int Area){
}
public void Main(string[] args)
{
Console.WriteLine("Triangle Area Calculator");
CalculateArea(); //function call
Console.WriteLine("Program Complete");
}
}

Answers (3)