Skip to content

CSharpLecture/Exercises.Day1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Exercises.Day1

Exercises and solutions for the first day.

1. Let's get started

Let's display some messages on the console and request the user to enter his name. Output a friendly welcome message with the user's name.

Run this application with the debugger and without the debugger. Can you see any differences? Try setting a breakpoint and play around with the debugger.

2. The first countdown

Use a for loop to create a countdown from 10 to 1. Each number should be displayed after a waiting time of 1 second. Realize that waiting period by using Thread.Sleep(1000) of the System.Threading namespace.

3. Currency converter

Write a little currency converter as a console application. The user should be asked to enter a value. Once a value has been entered the user is requested to enter a valid currency exchange rate. Afterwards the converted value should be displayed. Finally, if no error occurred, ask the user if another value should be converted. If yes, then start again by asking the user to enter a value. Otherwise exit the program.

4. A simple calculator

Request the user to enter two numbers and an operation (+, - or *). Use a switch statement to perform the right computation. Display the result.

5. Computing prime numbers

The user has to enter some number, which should be evaluated by your program. If the program detects a non-positive, or invalid number, the program should exit. Otherwise the evaluation should display if the entered number has been a prime number or not. In case of not being a prime number, the program has to display all the prime factors of the given number.

License

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

About

Exercises and solutions for the first day.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages