June 2006
Intermediate to advanced
1344 pages
42h 52m
English
Our next program (Fig. 3.16) inputs two integers (whole numbers) entered at the keyboard by a user, computes the sum of these integers and displays the result. As the user enters each integer and presses the Enter key, the integer is read into the program and added to the total.
1 ' Fig. 3.16: Addition.vb 2 ' Addition program. 3 4 Module Addition 5 6 Sub Main() 7 8 ' variables used in the addition calculation 9 Dim number1 As Integer 10 Dim number2 As Integer 11 Dim total As Integer 12 13 ' prompt for and read the first number from the user 14 Console.Write("Please enter the first integer:") 15 number1 = Console.ReadLine() 16 17 ' prompt for ... |
Read now
Unlock full access