Exercises for C# .NET lessons 1-3

C# .NET Basic constructs Exercises for C# .NET lessons 1-3

The following exercises will help you put your knowledge of C# .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 76x (116.74 kB)
Application includes source codes in language C#

 

 

Article has been written for you by David Capka
Avatar
Do you like this article?
2 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.
Unicorn College The author learned IT at the Unicorn College - a prestigious college providing education on IT and economics.
Thumbnail
All articles in this section
C# .NET basic constructs
Activities (12)

 

 

Comments

Avatar
Fardeen HameedBaha:12/4/2016 3:41

it was damn hard

 
Reply 12/4/2016 3:41
Avatar
David Capka
ICT.social team
Avatar
Replies to Fardeen HameedBaha
David Capka:12/4/2016 4:58

We're glad you made it! :) If you need any help, you can write to our forums or you can send me a message.

Edited 12/4/2016 4:59
Reply 12/4/2016 4:58
You can walk through a storm and feel the wind but you know you are not the wind.
Avatar
Replies to David Capka
Fardeen HameedBaha:12/4/2016 5:00

thank You David it is Your kindness may i have ur facebook or viber something that i could uses some of ur help please

 
Reply 12/4/2016 5:00
Avatar
David
Member
Avatar
David:5. March 5:45

Great lesson however I got stuck on the advanced one and upon downloading the answer script, I discovered that you used a new 'float' variable which was never mentioned in previous lessons. :(

 
Reply 5. March 5:45
Avatar
David
Member
Avatar
Replies to David
David:5. March 5:52

tried to replace float with decimal and does not work

Edited 5. March 5:55
 
Reply 5. March 5:52
Avatar
David Capka
ICT.social team
Avatar
Replies to David
David Capka:5. March 10:27

Hi David, you have to remove the F suffix in the source code to use double. We'll edit the attachment to use doubles as well to avoid the confusion. You can find more about data types in the following lesson. We're glad you're interested in our project so we added 10 points to your account for reporting the issue.

Reply 5. March 10:27
You can walk through a storm and feel the wind but you know you are not the wind.
Avatar
David Capka
ICT.social team
Avatar
Replies to David
David Capka:6. March 6:28

It's been updated.

Reply 6. March 6:28
You can walk through a storm and feel the wind but you know you are not the wind.
Avatar
David
Member
Avatar
Replies to David Capka
David:6. March 6:30

great, thanks David - look forward to continuing the course!

 
Reply 6. March 6:30
Avatar
Thomas Margison:25. March 12:22

So far lot's of fun. On to the next lesson.

 
Reply 25. March 12:22
Avatar
David Capka
ICT.social team
Avatar
Replies to Thomas Margison
David Capka:26. March 11:00

We're glad you like it, good luck with the other ones :)

Reply 26. March 11:00
You can walk through a storm and feel the wind but you know you are not the wind.
To maintain the quality of discussion, we only allow registered members to comment. Sign in. If you're new, Sign up, it's free.

10 messages from 10 displayed.