Do calculation with double value : double Calculation « Data Type « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.Text;

class Program {
    static void Main(string[] args) {
        double firstNumber, secondNumber;
        string userName;
        userName = "AAA";
        firstNumber = Convert.ToDouble("1.1");
        Console.WriteLine("Now give me another number:");
        secondNumber = Convert.ToDouble(1.2);
        Console.WriteLine("The sum of {0} and {1} is {2}.", firstNumber,
                    secondNumber, firstNumber + secondNumber);
        Console.WriteLine("The result of subtracting {0} from {1} is {2}.",
                    secondNumber, firstNumber, firstNumber - secondNumber);
        Console.WriteLine("The product of {0} and {1} is {2}.", firstNumber,
                    secondNumber, firstNumber * secondNumber);
        Console.WriteLine("The result of dividing {0} by {1} is {2}.",
                    firstNumber, secondNumber, firstNumber / secondNumber);
        Console.WriteLine("The remainder after dividing {0} by {1} is {2}.",
                    firstNumber, secondNumber, firstNumber % secondNumber);

    }
}








2.27.double Calculation
2.27.1.Implement the Pythagorean Theorem
2.27.2.doubles and arithmetic operators
2.27.3.Compute the area of a circle with 'double'
2.27.4.Calculate the radius of a circle given its area using Math function
2.27.5.Use the while statement to implement Newton's method for finding the square root
2.27.6.Do calculation with double value
2.27.7.double base Fahrenheit and Celsius (Centigrade) Scales
2.27.8.Returns the variable Area as a double value.