Assign result to both an integer and a double : Double « Data Types « VB.Net






Assign result to both an integer and a double

Assign result to both an integer and a double
   
Imports System

Public Class MainClass

    Shared Sub Main(ByVal args As String())
       Dim int1 As Integer = 12
       Dim int2 As Integer = 5
       Dim intAnswer As Integer
       Dim doubleAnswer As Double

       Console.WriteLine("{0} + {1} = {2}", int1, int2, int1 + int2)

       Console.WriteLine("{0} - {1} = {2}", int1, int2, int1 - int2)

       Console.WriteLine("{0} * {1} = {2}", int1, int2, int1 * int2)
       ' integer division
       intAnswer = int1 \ int2
       doubleAnswer = int1 \ int2
       Console.WriteLine("{0} \ {1} = [integer] {2}  [double] {3}", _
           int1, int2, intAnswer, doubleAnswer)

       ' division. Assign result to both an integer and a double
       ' note, option strict must be off!
       intAnswer = int1 / int2
       doubleAnswer = int1 / int2
       Console.WriteLine("{0} / {1} = [integer] {2}  [double] {3}", _
           int1, int2, intAnswer, doubleAnswer)

    End Sub
End Class

           
         
    
    
  








Related examples in the same category

1.Double Structure Represents a double-precision floating-point number.
2.Double: Set number, multiply numbers, and display resultsDouble: Set number, multiply numbers, and display results
3.Double: Set number, divide numbers, and display resultsDouble: Set number, divide numbers, and display results
4.Double number format: 0:n3Double number format: 0:n3
5.Double value calculationDouble value calculation
6.Append Double data type values to a StringBuilder object.
7.Generic and nongeneric versions of the CompareTo method for Double value
8.Use the Sign(Double) method to determine the sign of a Double value and display it to the console.
9.Use Double.Parse to parse double string value
10.Convert Double.MinValue to string
11.Use CInt to convert Double to Integer
12.Double Structure Represents a double-precision floating-point number.
13.Double variable
14.Parse string to double value
15.Double ToString("#####")
16.Double Structure Represents a double-precision floating-point number.
17.Temperature class stores the value as Double and delegates most of the functionality to the Double implementation.
18.Double.Epsilon Field Represents the smallest positive Double value that is greater than zero. This field is constant.
19.Double.Equals Method
20.Compare Double values with difference
21.Double.Parse Method
22.Double.ToString Method
23.Double.ToString Method Converts the numeric value of this instance to its equivalent string representation.
24.Parse a string read from console to Double
25.Double.TryParse Method (String, Double) Converts string to double-precision floating-point number