Write an application that displays the result of dividing two numbers and displays any
remainder. The main() method prompts the user for values and sends them to the dividing
method; the dividing method performs the calculation and displays the results. Save the
application as Divide.cs
using System;
namespace Questions
{
class Program
{
static void dividing(double firstNumber, double secondNumber)
{
double divisionResult = firstNumber / secondNumber;
Console.WriteLine("Division result: " + divisionResult);
double reminder = firstNumber % secondNumber;
Console.WriteLine("Reminder: " + reminder);
}
static void Main()
{
Console.Write("Enter first number: ");
double firstNumber = double.Parse(Console.ReadLine());
Console.Write("Enter second number: ");
double secondNumber = double.Parse(Console.ReadLine());
Console.WriteLine();
dividing(firstNumber, secondNumber);
Console.ReadKey();
}
}
}
Comments
Leave a comment