Videos to Watch - Week 1
- Course Introduction
- Installing Visual Studio
- Creating Your First C# Program
- Understanding Your First C# Program
- Working with Code Files, Projects, and Solutions
- Understanding Data Types and Variables
- The if Decision Statement
- Operators, Expressions, and Statements
- For Iteration Statement
Problems - Week 1
Problem 1
Helpful Links
- https://docs.microsoft.com/en-us/visualstudio/ide/quickstart-ide-orientation
- https://docs.microsoft.com/en-us/visualstudio/ide/quickstart-projects-solutions
- https://docs.microsoft.com/en-us/visualstudio/ide/how-to-move-around-in-the-visual-studio-ide
Create a basic C# console application that prints the text "Hello World" to the screen when run.
Problem 2
Write a C# program to print the result of dividing 24 into 5 on screen.
Problem 3
Write a C# program to print on screen the result of adding, subtracting, multiplying and dividing two numbers typed by the user. The remainder of the division must be displayed, too.
Enter a number: 12Enter another number: 3
12 + 3 = 15
12 -3 = 9
12 x 3 = 36
12 / 3 = 4
12 mod 3 = 0
Convert input (which will always be a string) to integer with the following:
string number = Console.ReadLine(); int num = int.Parse(number);
Problem 4
Write a C# program to calculate and display the average of four numbers entered by the user.
Problem 5
Write a C# program to get a number from the user and answer whether it is positive or negative.
Problem 6
Create a program which assigns a integer variable "amountOfPositives" the value 0, 1 or 2, depending on the values of two numbers a & b (entered by the user). For example, if the user enters 3 and -2 seperately, it will assign 1 to amountofPostives since there was only one postive number out of the two entered by the user.
Problem 7
Write a program that takes a number from the user and prints:
- "fizz" if it is divisible by 3
- "buzz" if it is divisible by 5
- "fizz buzz" if it is divisible by 3 and 5
Problem 8
Write a C# program to get three numbers from the user and display the greatest one.
Problem 9
Write a program that asks for 1 input, a number score (which will be anywhere between 0-100). It will then print out the grade (either "A", "B", "C", "D", or "F") associated with that number. e.g. "A" will be printed if the number entered was 93.
Problem 10
Write a program that takes an input that is number, and will output all the numbers between that number and 0, one by one.
Problem 11
Write a program, which asks for a character and a width, and displays a square of that width, using that number for the inner symbol, as in this Example:
Enter a character: z
Enter the desired width: 3
zzz
zzz
zzz
Problem 12
Print all the odd numbers from 1 to a user specifiable upper limit (inclusive). Example:
Please enter a number: 9
1 3 5 7 9
Problem 13
Let's build upon problem 7. Have the program do the same thing except loop through from range of 1 to n, printing fizz buzz. If the number in the range is not divisble by 3 or 5, then just print the number. Example:
Enter a number: 16
16
fizz
buzz
14
13
fizz
11
buzz
fizz
8
7
fizz
buzz
4
fizz
2
1
Problem 14
Given an array with values, print the sum of the elements of that array.
int[] numbers = {1,2,3,4,5}; // it should print out: 15
Problem 15
Given an array with values, print out every odd indexed element.
int[] numbers = {1,4,2,6,5,8}; //it should print out 4 6 8
Problem 16
Given an even sized array, determine if the sum of the first half elements equal the sum of the second half.
int[] array = {1,2,3,2,2,2}; //true: 1 + 2 + 3 is equal to 2 + 2 + 2
Continue to Week 2