static void Main(string[] args) { Console.WriteLine("Enter a double precision number"); double number = ISSConsole.ReadDouble(); double squareRootOfNumber = Math.Sqrt(number); Console.WriteLine("The square root of the number" + squareRootOfNumber); }
static void Main(string[] args) { Console.WriteLine("Enter the km"); double kmsTravelled = ISSConsole.ReadDouble(); double fare = 2.40 + kmsTravelled * 0.4; Console.WriteLine("The fare is {0:##.#0}", Math.Round(fare, 1)); }
static void Main(string[] args) { Console.WriteLine("Enter a double precision number"); double doubleNumber = ISSConsole.ReadDouble(); double squareDouble = doubleNumber * doubleNumber; Console.WriteLine("the square of double precision number is =" + squareDouble); }
static void Main(string[] args) { Console.WriteLine("Enter the value of x"); double x = ISSConsole.ReadDouble(); double y = 5 * Math.Pow(x, 2) - 4 * x + 3; Console.WriteLine("The value of y is " + y); }
static void Main(string[] args) { Console.WriteLine("Enter the centigrade"); double C = ISSConsole.ReadDouble(); double fahrenheit = 1.8 * C + 32; Console.WriteLine("The fahrenheit is " + fahrenheit); }
static void Main(string[] args) { Console.WriteLine("Enter a double precision number to find square root and round to 3 decimals"); double number = ISSConsole.ReadDouble(); double sqrt = Math.Sqrt(number); double round3 = Math.Round(sqrt); Console.WriteLine("The square root of " + number + " is " + sqrt + " \n" + "It is rounded of to 3 decimals as {0:##.###}", sqrt); // Console.WriteLine("The square root of " + number + " is " + sqrt); //Console.WriteLine("The rounded value is {0:##.000}" , sqrt); }
static void Main(string[] args) { double salary = 0.0; double housingAllowance = 0.0; double transport_allowance = 0.0; Console.WriteLine("Enter the salary"); salary = ISSConsole.ReadDouble(); housingAllowance = salary * 0.1; transport_allowance = salary * 0.03; double totalSalary = salary + housingAllowance + transport_allowance; System.Console.WriteLine("The salary of the employee is " + totalSalary); }
static void Main(string[] args) { Console.WriteLine("Enter the value of x and y"); double x1 = ISSConsole.ReadDouble(); double x2 = ISSConsole.ReadDouble(); double y1, y2; y1 = ISSConsole.ReadDouble(); y2 = ISSConsole.ReadDouble(); double diff_x = x2 - x1; double diff_y = y2 - y1; double distance = Math.Sqrt(Math.Pow(diff_x, 2) + Math.Pow(diff_y, 2)); Console.WriteLine("The value of y is " + distance); }
public static void Ex19() { Console.Write("Please insert the distance travelled (by km): "); double input = ISSConsole.ReadDouble(); double distance = (Math.Ceiling(input * 10)) / 10; double totalCost = 2.40; if (distance >= 0.5) { if (distance <= 9) { totalCost += (distance - 0.5) * 0.04; } else { totalCost += 8.5 * 0.04 + (distance - 9) * 0.05; } } Console.WriteLine($"Total cost is: {totalCost:c}"); }