Assign result to both an integer and a double : Double « Language Basics « VB.Net

VB.Net
1. 2D
2. Application
3. Class
4. Data Structure
5. Database ADO.net
6. Development
7. Event
8. File Directory
9. Generics
10. GUI
11. Language Basics
12. Network Remote
13. Thread
14. Windows System
15. XML
Microsoft Office Word 2007 Tutorial
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net Tutorial
VB.Net » Language Basics » DoubleScreenshots 
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: Set number, multiply numbers, and display resultsDouble: Set number, multiply numbers, and display results
2. Double: Set number, divide numbers, and display resultsDouble: Set number, divide numbers, and display results
3. Double number format: 0:n3Double number format: 0:n3
4. Double value calculationDouble value calculation
ww_w___.__j__av_a2s_.___c__o___m___ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.