write a VB.net program to swap two numbers

Answers were Sorted based on User's Feedback



write a VB.net program to swap two numbers..

Answer / basudev_kan

Module Basudev
Sub Main()
dim a,b,te as integer
System.console.writeline("Enter The Two Number:")
a=System.Console.ReadLine()
b=System.console.ReadLine()
System.console.WriteLine("The Two Number is:{0} And{1}:",a,b)
te=a
a=b
b=te
System.console.WriteLine("After Swapping Value is:{0} and
{1}:",a,b)
Ssytem.console.ReadLine()
End Sub
End Module

Is This Answer Correct ?    81 Yes 42 No

write a VB.net program to swap two numbers..

Answer / biswasmit lenka

Private sub command1_click()
dim a,b,c as integer
a=Val(Text1.Text)
b=Val(Text1.Text)
c=a
a=b
b=c
Text1.text=b
text2.text=a
End sub
Private sub command2_click
end
End sub

Is This Answer Correct ?    37 Yes 12 No

write a VB.net program to swap two numbers..

Answer / tarunkumar

vb.net programm to swap two numbers without using third
variable is as follows

public class form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles MyBase.Load
Dim a As integer
Dim b As integer
a=a+b
b=a-b
a=a-b
End Sub
End class

vb.net programm to swap two numbers using three variables
is as follows

public class form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles MyBase.Load
Dim a As integer
Dim b As integer
Dim temp As integer
temp=a
a=b
b=temp
End Sub
End class

this programm is written in window application because the
question tells to write vb.net programm only but not
console application

Is This Answer Correct ?    34 Yes 12 No

write a VB.net program to swap two numbers..

Answer / vineetha.balan

Module Vineetha
Sub Main()
dim a,b,te as integer
System.console.writeline("Enter The Two Number:")
a=System.Console.ReadLine()
b=System.console.ReadLine()
System.console.WriteLine("The Two Number is:{0} And
{1}:",a,b)
te=a
a=b
b=te
System.console.WriteLine("After Swapping Value is:{0} and
{1}:",a,b)
System.console.ReadLine()
End Sub
End Module

Is This Answer Correct ?    23 Yes 13 No

write a VB.net program to swap two numbers..

Answer / vineetha

Module Basudev
Sub Main()
dim a,b,te as integer
System.console.writeline("Enter The Two Number:")
a=System.Console.ReadLine()
b=System.console.ReadLine()
System.console.WriteLine("The Two Number is:{0} And
{1}:",a,b)
te=a
a=b
b=te
System.console.WriteLine("After Swapping Value is:{0} and
{1}:",a,b)
Sytem.console.ReadLine()
End Sub
End Module

Is This Answer Correct ?    14 Yes 17 No

Post New Answer

More VB.NET Interview Questions

Explain the difference between vb.net and c#, related to oops concepts?

0 Answers  


What is shadowing?

5 Answers   TCS,


1234 123 12 1 how to design above pic in vb.net?

2 Answers   ABC,


What is an indexed property?

1 Answers  


What is difference between Abstract Class and Interface?

3 Answers  






How do you define a read only property in a class module?

0 Answers  


what is vb.net?

10 Answers  


How would you implement inheritance using vb.net?

0 Answers  


Write a program to find all text files in a logical drive and return the count of the number of files?

0 Answers  


What is the Difference between CLR & CTS?

3 Answers  


What do you mean by serialization?

0 Answers  


Explain how to achieve polymorphism in vb.net?

0 Answers  


Categories