Do calculation with double value : Double Calculation : Data Type C# Examples


C# Examples » Data Type » Double Calculation »

 

Do calculation with double value









    
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);

        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» Double Calculation