Save up to 80 % on our HTML/CSS and JavaScript e-learning courses. Only this week!
Get up to 80 % extra points for free! More info

# Solved tasks for Visual Basic .NET lessons 1-3

The following exercises will help you put your knowledge of Visual Basic .NET to the test. Based off of what you've learned from previous lessons. Try to solve them on your own, but know that you could always download the working solutions under the article. Nonetheless, beware that when you view the solution without solving the exercise, you won't learn anything

If you find yourself stuck at some point, you should always try going back to check previous tutorials first and figure the problem out by yourself.

## Easy exercise

Create an application which will ask for a username and then for his/her ability. Then the program will print "name is ability", see image below.

The application screen sample:

```Console application
Hi, what is your name?
Bill Gates
What are you like?
ultraepic rich
Bill Gates is ultraepic rich```

## Intermediate exercise

Create an application which will ask for an integer and prints its second power (x squared).

The application screen sample:

```Console application
Enter a number, and I'll square it:
64
Result: 4096```

## Advanced exercise

Create an application that will ask for a circle's radius. Then print its circumference and its area.

The application screen sample:

```Console application
Enter the circle's radius (cm):
12.1
The circle's circumference based on the given radius is: 75.98801 cm
Area of the circle is: 459.7274 cm^2```

### Download

Downloaded 49x (109.97 kB)
Application includes source codes in language VB.NET

Article has been written for you by David Capka
Do you like this article?
1 votes
The author is a programmer, who likes web technologies and being the lead/chief article writer at ICT.social. He shares his knowledge with the community and is always looking to improve. He believes that anyone can do what they set their mind to.
The author learned IT at the Unicorn University - a prestigious college providing education on IT and economics.

Comments

wasim
Member
wasim:6/23/2019 20:37

I don't know it's the right way or not, can you please have a look at the first exercise.

Console.Write­Line("Hi, what is your name? ")
Dim input, output As String
input = Console.ReadLine()

Console.Write­Line("What are you like? ")
output = Console.ReadLine()
Console.Write­Line(input & " is " & output)

Console.ReadKey()
Thank you

6/23/2019 20:37
wasim
Member
wasim:6/23/2019 20:47

Intermediate exercise code
Console.Write­Line("Enter a number, and I'll square it: ")
Dim sqrt As Double
sqrt = Console.ReadLine()

Console.Write­Line("Result: " & sqrt ^ 2)
Console.ReadKey()
Please tell me doing right Thank you

6/23/2019 20:47
wasim
Member
wasim:6/24/2019 0:00

The last one took me so long to figure it out, I am pretty sure it's the wrong code.

Console.Write­Line("Enter the circle's radius (cm):")
Dim c, r, pi As Double
pi = 3.142
c = 2 * 3.142 * r
r = Console.ReadLine()

Console.Write­Line("The circle's circumference based on the given radius is: " & 2 * 3.142 * r & " cm")
Console.Write­Line("Area of the circle is: " & r * r * pi & "cm2")
Console.ReadKey()
Thank you

Edited 6/24/2019 0:02

6/24/2019 0:00
David Capka
ICT.social team
Replies to wasim
David Capka:6/24/2019 5:23

Hi wasim,
all the 3 codes you posted are ok. The last result is a bit different than ours since you chose your `pi` to be `3.142` but it's not specified in the task description so you passed. Good job

6/24/2019 5:23
You can walk through a storm and feel the wind but you know you are not the wind.
wasim
Member
Replies to David Capka
wasim:6/25/2019 18:14

Thank you, David.

6/25/2019 18:14
To maintain the quality of discussion, we only allow registered members to comment. Sign in. If you're new, Sign up, it's free.

5 messages from 5 displayed.