Hi this is for C Write a C method that takes two parameters
Hi, this is for C#
Write a C# method that takes two parameters, unitPrice, quantityPurchased, and returns the total cost for that purchase.
Solution
using System.IO;
using System;
using static System.Console;
class Program {
static void Main() {
WriteLine(\"Total Cost: \"+getTotalCost(5.5, 10));
}
static double getTotalCost(double unitPrice, int quantityPurchased){
return unitPrice * quantityPurchased;
}
}
Output:
sh-4.3$ mcs *.cs -out:main.exe
sh-4.3$ mono main.exe
Total Cost: 55
