The sum of the first n natural numbers is a recursive function such that f(n) is f(n-1)+n for all values n >1 where f(1) is 1. Although the function is naturally recursive, an iterative implementation would prove more efficient:
Function sum_naturals(ByVal num As UInteger) As UInteger
sum_naturals = 0
While (num > 0)
sum_naturals = sum_naturals + num
num = num - 1
End While
End Function
Sub Main()
Console.Write("The sum of all naturals 1 to 42 is: ")
Console.WriteLine(sum_naturals(42))
End Sub
You never specified what do you mean by 'n' numbers.
to get a sum of two numbers, assign both to value
(ex: dim num1 as integer = textbox1.text
dim num2 as integer = textbox2.text )
or another example:
dim num1 as integer = 2398
dim num2 as integer = 2989
now write:
label1.text = num1 + num2
for the output (answer) to appear on label1
to make it appear in a msgbox do
msgbox(num1 + num2)
or
dim num3 as integer = num1 + num2
msgbox(num3)
and for a more good looking way:
msgbox( "the answer is: " & num3)
find even number in array
One place to find information on visual basic coding is a local library. The website msdn microsoft has extensive tutorials and guides on visual basic coding.
First you will need to have some basic programming knowledge. You can use this to help make the program that is needed.
bwiset
Tutorials for Visual Basic can be found on MSDN Microsoft, Amos Development, and Home and Learn UK. The Engineering Department at Auburn University also offers a very detailed tutorial for Visual Basic.
find even number in array
There are many online sites where and individual can find basic tutorial showing how to make a virus. There are tutorials on HackTweaks and Youtube that show how to make a virus with the program Visual Basic.
One place to find information on visual basic coding is a local library. The website msdn microsoft has extensive tutorials and guides on visual basic coding.
Once you have the Visual Studio program open, go to File->New Project and select the language you want to write your program in. If one or more languages do not appear, you probably didn't choose to have them installed when you installed Visual Studio.
First you will need to have some basic programming knowledge. You can use this to help make the program that is needed.
bwiset
Tutorials for Visual Basic can be found on MSDN Microsoft, Amos Development, and Home and Learn UK. The Engineering Department at Auburn University also offers a very detailed tutorial for Visual Basic.
In visual basic: Module Module1 Sub Main() Dim Inst As Integer For Inst = 0 To 100 Step 2 Console.WriteLine(Inst) Next End Sub End Module
cheggcom has a great group to answer
- If you mean to get the code from an exe file ... well, that is illegal. - Its not illegal if you created the code in the first place ... So an answer can not be given here. If you find some way to get the source out of the exe and THEN prove that you own it then every thing should be OK.
program to find maximum of two numbers using pointers
VBnet program to find the prime numbers between 100 to 200?