-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy pathCheckpoint1.cs
More file actions
83 lines (69 loc) · 3.11 KB
/
Checkpoint1.cs
File metadata and controls
83 lines (69 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using System;
namespace Checkpoint1
{
class Program
{
static void Main()
{
Console.WriteLine("~~~~~~~~~~~~~~~Application 1~~~~~~~~~~~~~~~");
Console.WriteLine(100 / 3);
Console.WriteLine("~~~~~~~~~~~~~~~Application 2~~~~~~~~~~~~~~~");
Console.WriteLine("Please enter a number:");
int firstInput = int.Parse(Console.ReadLine());
Console.WriteLine("Please enter another number:");
int secondInput = int.Parse(Console.ReadLine());
Console.WriteLine("Please enter a final number:");
int thirdInput = int.Parse(Console.ReadLine());
if ((firstInput + secondInput + thirdInput) == 666){
Console.WriteLine("Your number is 666. HAIL SATAN!!!");
}
else{
Console.WriteLine("Your number is " + (firstInput + secondInput + thirdInput));
}
Console.WriteLine("~~~~~~~~~~~~~~~Application 3~~~~~~~~~~~~~~~");
Console.WriteLine("Please enter the number you wish to factorize");
int number = int.Parse(Console.ReadLine());
Console.WriteLine("The number you entered was {0} and it's factorial is {1}", number, Factorial(number));
Console.WriteLine("~~~~~~~~~~~~~~~Application 4~~~~~~~~~~~~~~~");
Random rnd= new Random();
int rndnumber = rnd.Next(1,11);
Console.WriteLine("I'm thinking of a number 1 through 10. Take a guess:");
int userGuessOne = int.Parse(Console.ReadLine());
if (rndnumber == userGuessOne){
Console.WriteLine("Wow, you got it on the first try! Way to go!");
}
else {
Console.WriteLine("Not the one, I'm thinking of. Try again!");
}
int userGuessTwo = int.Parse(Console.ReadLine());
if (rndnumber == userGuessTwo){
Console.WriteLine("Good job! Way to get it right!");
}
else {
Console.WriteLine("Missed again, give it another shot!");
}
int userGuessThree = int.Parse(Console.ReadLine());
if (rndnumber == userGuessThree){
Console.WriteLine("Third time is the charm! Way To Go!");
}
else {
Console.WriteLine("Missed three shots in a row huh? Give it ONE more try!");
}
int userGuessFour = int.Parse(Console.ReadLine());
if (rndnumber == userGuessFour){
Console.WriteLine("I knew you would come through in the end. Great job!");
}
else {
Console.WriteLine("Well...you miss 100% of the shots you don't take.");
}
Console.WriteLine("~~~~~~~~~~~~~~~Application 5~~~~~~~~~~~~~~~");
Console.WriteLine("Enter a set of numbers separated by a comma (,). Use as many as you'd like!");
Console.ReadKey(true);
}
static int Factorial(int n)
{
if (n >= 2) return n * Factorial(n - 1);
return 1;
}
}
}