
class Program1
{
//a method is a block of code
static void Main()
{
}
}
class Program1
{
//a method is a block of code
static void Main()
{
Console.WriteLine("hello,world!");
//add one more line of text
Console.WriteLine("hello,world, again!");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
Console.WriteLine("hello,world!");
//add one more line of text
Console.WriteLine("hello,world, again!");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
//make a program that beeps
Console.Beep();
Console.ReadLine();
}
}
class Program1
{
//a method is a block of code
static void Main()
{
//make a program that beeps
Console.Beep();
Console.ReadLine();
//run the program and input 5 , look carefully inside the
//locals or autos window
}
}
class Program
{
static void Main()
{
Console.WriteLine("\rHello");
Console.WriteLine(" Hello");
Console.WriteLine(" \rHello");
Console.WriteLine("\nHello");
//combine \r\n
Console.WriteLine("hello");
Console.WriteLine(" \r\nhello");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
Console.WriteLine("Hello");
Console.WriteLine("Hello,world!....." +
//string inside text 1
"It's nice to meet you today");
Console.WriteLine(@"It's a great day
//string inside text 2
to meet you. ");
//print 1,2,3 in a column aligned on LHS using @
Console.WriteLine(@"1
2
3");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
Console.WriteLine(@"c:\hello");
Console.WriteLine("c:\\hello");
Console.WriteLine(@"\tHello");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
Console.WriteLine($"2*3={2*3}");
//using string interpolation, show 4-5
Console.WriteLine($"4-5={4 - 5}\n" +
$"This is being done using string interpolation.");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
Console.WriteLine("hello".ToUpper());
//display HELLO in all lower case
Console.WriteLine("HELLO".ToLower());
Console.WriteLine($"2*3 IS eQUal to {2 * 3}".ToLower());
}
}
class Program1
{
//a method is a block of code
static void Main()
{
Console.WriteLine($"2+3={2 + 3}");//2+3=5, not 5.0
Console.WriteLine($"2-3={2 - 3}");//2-3=-1, not -1.0
//pause video and add the division /, *
Console.WriteLine($"2/3={2 / 3}");//-5,0,250, not .23
Console.WriteLine($"2*3={2 * 3}");
Console.WriteLine($"4/3={4 /3}");//how many times
//whole does 3 go into 4? once
}
}
class Program1
{
//a method is a block of code
static void Main()
{
Console.WriteLine($"9/4={9 / 4}");
//7-2=5,5-2=3,3-2=1, 1-2=-1
Console.WriteLine($"9%4={9 % 4}");
//repeat above using 9/4 and 9%4 (integer)
//9-4=5, 5-4=1, 1-4=-3
}
}
class Program1
{
//a method is a block of code
static void Main()
{
Console.WriteLine($"4*5-2*3={4*5-2*3}");//20-6=14 PEMDAS
Console.WriteLine($"2*3/4={2*3/4}");//6/4=1.5
Console.WriteLine($"2*(3/4)={2*(3/4)}");
//pause and predict the value from 2*(3/4)
Console.WriteLine($"4*(5/2)={4*(5/2)}");//4*2=8, not 20/2=10
//pause and predict the value from 4(5/2)
}
}
class Program1
{
//a method is a block of code
static void Main()
{
Console.WriteLine($"2/3={2 / 3.0}");
Console.WriteLine($"2/3={2 / 3M}");
//1,234,567.58
Console.WriteLine(1_234_567.58);
//can a double data type be multiplied by a decimal?
//Console.WriteLine($"2M*4d={2M * 4d}");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
//2.3,-5.49
//ave=(one value+second value)/2
Console.WriteLine($"Avg of 2 and 3={(2 + 3.0) / 2}");
//avg of 2,3 and 7
Console.WriteLine($"avg of 2.5,3 and 7={(2.5 + 3 + 7.0) / 3}");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
//2.3,-5.49
//avg=(one value+second value)/2
Console.WriteLine($"Avg of 2.57 and 3.23=" +
$"{Math.Round((2.57 + 3.23) / 2,2)}");
//avg of 2,3 and 7 and round to 2 decimal places
Console.WriteLine($"avg of 2.5,3 and 7=" +
$"{Math.Round((2.5 + 3 + 7.0) / 3,2)}");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
Console.WriteLine("area=base*height");
Console.WriteLine($"base=2.3, height=4.56," +
$"area={Math.Round(2.3 * 4.56,2)}");
//find perimeter of rectangle with height 2.3 and width=4.89
//formula, code up the calculation,P=2h+2w
Console.WriteLine($"h=2.3, w=4.89," +
$"p={Math.Round(2*2.3+2*4.89,2)}");
//round to two decimal places above
}
}
class Program1
{
//a method is a block of code
static void Main()
{
Console.WriteLine("Facts About Circles with Radius 3");
Console.WriteLine($"Area={Math.Round(Math.PI * 3 * 3,2)}");//3^2=3*3
//find the circumference
Console.WriteLine($"C={Math.Round(2*Math.PI*3,2)}");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
Console.WriteLine($"Square root of 4={Math.Sqrt(4)}");//2 b/c 2*2=4
Console.WriteLine($"Square root of 4={Math.Sqrt(-4)}");
Console.WriteLine($"Cube root of -8={Math.Cbrt(-8)}");//(-2)(-2)(-2)=-8
}
}
class Program1
{
//a method is a block of code
static void Main()
{
Console.WriteLine($"6th root of 729=" +
$"{Math.Cbrt(Math.Sqrt(729))}");
//find the 12th root of 1034
}
}
class Program1
{
//a method is a block of code
static void Main()
{
//"2",2, "2"->2
Console.WriteLine($"2*3={int.Parse("2") * int.Parse("3")}");
Console.WriteLine($"2.5*3.8={double.Parse("2.5")*double.Parse("3.8")}");
}
}
Declare and assign integer variables in C# using int, then display values with Console.WriteLine, using string interpolation and curly braces to show x, y, and their sum.
class Program1
{
//a method is a block of code
static void Main()
{
int x=int.Parse("3");
int y=int.Parse("4");
Console.WriteLine($"{x}+{y}={x+y}");
//find x-y, y-x, 4-3=1, 3-4=-1
Console.WriteLine($"{x}-{y}={x-y}");
//find the absolute value of x-y
Console.WriteLine($"|{x}-{y}|={Math.Abs(x-y)}");
Console.WriteLine($"|{y}-{x}|={Math.Abs(y - x)}");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
double x=double.Parse(Console.ReadLine());
double y=double.Parse(Console.ReadLine());
Console.WriteLine($"{x}+{y}={x+y}");
//find x-y, y-x, 4-3=1, 3-4=-1
Console.WriteLine($"{x}-{y}={x-y}");
//find the absolute value of x-y
Console.WriteLine($"|{x}-{y}|={Math.Abs(x-y)}");
Console.WriteLine($"|{y}-{x}|={Math.Abs(y - x)}");
}
}
{
//a method is a block of code
static void Main()
{
Console.WriteLine("Enter First Value");
string s1 = Console.ReadLine();
double x=double.Parse(s1);
Console.WriteLine("Enter Second Value");
string s2 = Console.ReadLine();
double y=double.Parse(s2);
Console.WriteLine($"{x}+{y}={x+y}");
//find x-y, y-x, 4-3=1, 3-4=-1
Console.WriteLine($"{x}-{y}={x-y}");
//find the absolute value of x-y
Console.WriteLine($"|{x}-{y}|={Math.Abs(x-y)}");
Console.WriteLine($"|{y}-{x}|={Math.Abs(y - x)}");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
double x;
x = 2.5;
Console.WriteLine($"x={x}");
double y = x;
Console.WriteLine($"y={y}");
x = 10;
Console.WriteLine($"x={x}");
Console.WriteLine($"y={y}");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
int x = 7;
Console.WindowHeight = 5;//try to assign negative values
Console.WindowWidth = 10;
//set the title of our window to: Our Console Program
Console.Title = "Our Console Program";
Console.ReadKey();
}
}
class Program1
{
//a method is a block of code
static void Main()
{
Console.WriteLine($"I have {2:C}");
Console.WriteLine($"I have {2*4.9:C}");
//5 is 50% of 10. 5/10=50/100
Console.WriteLine($"5 is {5d/10:P} of 10 ");
//x,y, x is th top, y is the bottom, x/y:P, double
double x = 4, y = 100;
Console.WriteLine($"{x} is {x/y:P} of {y}");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
Console.WriteLine($"3<4: {3<4}");
Console.WriteLine($"3<=3: {3 <= 3}");
Console.WriteLine($"4>5: {4>5}");
Console.WriteLine($"10>=10: {10>=10}");//true or false? code it up
Console.WriteLine($"10=10: {10==10} ");
Console.WriteLine($"Is 10 not equal to 10?: {10!=10}");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
//update the code so variables of type double are used
double x = 6, y = 5;
Console.WriteLine($"{x}<{y}: {x < y}");
Console.WriteLine($"{x}<={y}: {x <= y}");
Console.WriteLine($"{x}>{y}: {x > y}");
Console.WriteLine($"{x}>={y}: {x >= y}");//true or false? code it up
Console.WriteLine($"{x}={y}: {y == x} ");
Console.WriteLine($"Is {x} not equal to {y}: {x != y}");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
int x = 1;
Console.WriteLine($"x={x}");
Console.WriteLine($"++{x}={++x}");
Console.WriteLine($"x={x}");
Console.WriteLine($"{x}++={x++}");
Console.WriteLine($"x={x}");
//what happens when we do --x
Console.WriteLine($"--{x}={--x}");
Console.WriteLine($"x={x}");
//what happens when we do x--
Console.WriteLine($"{x}--={x--}");
Console.WriteLine($"x={x}");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
decimal x = 1.2M;
Console.WriteLine($"x={x}");
Console.WriteLine($"++{x}={++x}");
Console.WriteLine($"x={x}");
Console.WriteLine($"{x}++={x++}");
Console.WriteLine($"x={x}");
//what happens when we do --x
Console.WriteLine($"--{x}={--x}");
Console.WriteLine($"x={x}");
//what happens when we do x--
Console.WriteLine($"{x}--={x--}");
Console.WriteLine($"x={x}");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
//%
Console.WriteLine($"5.6%2.3={5.6%2.3}");
Console.WriteLine($"5.6-2.3-2.3={5.6-2.3-2.3}");
//abcdabcdabcd... , block=abcd,725thposition?
Console.WriteLine($"725%4={725%4}");//725positio has a as the char.
}
}
class Program1
{
//a method is a block of code
static void Main()
{
double x = 5;//int y=10;
x +=5;//x=x+5
Console.WriteLine($"x={x}");
x -= 2;//x=x-2
Console.WriteLine($"x={x}");
//show the following : x=x*3;
x *= 3;
Console.WriteLine($"x={x}");
x /= 4;//x=x/4;
Console.WriteLine($"x={x}");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
Console.WriteLine($"Boolean value={true}");
Console.WriteLine($"Boolean value={false}");
Console.WriteLine($"2<3: {2 < 3}");
Console.WriteLine($"2<=2: {2<=2}");
Console.WriteLine($"1<=2: {1<=2}");
Console.WriteLine($"4>=4: {4>=4}");//what's the output and why?
Console.WriteLine($"5>=4 {5>=4}");
Console.WriteLine($"5>4 {5 > 4}");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
//flip all <
Console.WriteLine($"Boolean value={true}");
Console.WriteLine($"Boolean value={false}");
Console.WriteLine($"2>3: {2 > 3}");
Console.WriteLine($"2>=2: {2>=2}");
Console.WriteLine($"1>=2: {1>=2}");
Console.WriteLine($"4<=4: {4<=4}");//what's the output and why?
Console.WriteLine($"5<=4: {5<=4}");
Console.WriteLine($"5<4: {5 < 4}");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
double x = 2, y = 1;
Console.WriteLine($"{x}<={y}:{x<=y}");
Console.WriteLine($"{x}<{y}:{x<y}");
Console.WriteLine($"{x}>={y}:{x>=y}");
//figure out the last case
Console.WriteLine($"{x}>{y}:{x>y}");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
double x = 5.0, y = 4;
Console.WriteLine($"Does {x} equal to {y}? {x == y}");
Console.WriteLine($"Does {x} not equal to {y}? {x!=y}");
Console.WriteLine($"true flipped={!true}");
Console.WriteLine($"false flipped={!false}");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
double x = 2;
double y = 3 * (x / 3);//3*1/3=(3*1)/3=3/3=1
Console.WriteLine($"Are {x} and 3*({x}/3) the same? {x==y}");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
Console.WriteLine($"!(2<4): {!(2<4)}");
Console.WriteLine($"!(4>3): {!(4>3)} ");//predict the truth value
Console.WriteLine($"!(2!=2): {!(2!=2)}");
Console.WriteLine($"!(!(!true))): {!!!true}");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
Console.WriteLine($"true and true: {true && true} ");
Console.WriteLine($"true and false: {true && false} ");
Console.WriteLine($"false and true: {false && true} ");
Console.WriteLine($"false and false: {false && false} ");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
Console.WriteLine($"true and true: {true && true} ");
Console.WriteLine($" 3>2 && 5>3: {3>2 && 5>3}");
Console.WriteLine($"true and false: {true && false} ");
Console.WriteLine($"5>2 && 4==5: {5>2 && 4==5}");
Console.WriteLine($"false and true: {false && true} ");
Console.WriteLine($"2!=2 && 5==5: {2!=2 && 5==5}");
Console.WriteLine($"false and false: {false && false} ");
Console.WriteLine($"1<0 && 0>1: {1<0 && 0>1}");
Console.WriteLine($"!(2<3) && !(3!=2): {!(2<3) && !(3!=2)}");//ultimate truth value
//false && false=FALSE
}
}
class Program1
{
//a method is a block of code
static void Main()
{
double x = 0;
// 0 1 6
Console.WriteLine($"1<{x} && {x}<6: {1<x && x<6}");
//1<5 and 5<6 : true and true: True
//1<7 and 7<6: true and false: False
//1<0 and 0<6: false and true: False
}
}
class Program1
{
//a method is a block of code
static void Main()
{
Console.WriteLine($"true or true: {true || true}");
Console.WriteLine($"2<3 || 5<10: {2<3 || 5<10}");
Console.WriteLine($"true or false: {true || false}");
Console.WriteLine($"2<3 || 10<5: {2 < 3 || 10 < 5}");
Console.WriteLine($"false or true: {false || true}");
Console.WriteLine($"5!=5 || 10==10: {5!=5 || 10 == 10}");
Console.WriteLine($"false or false: {false || false}");
Console.WriteLine($"!(2<3) || !!(5>10): {!(2<3) || !!(5>10)}");
}
}
class Program1
{
//a method is a block of code
static void Main()
{
double x = 5;
Console.WriteLine($"{x}>=1 || {x} <=8: {x>=1 || x<=8}");
//1***5**8 5>=1 or 5<=8 true or true:True
x = 10;
Console.WriteLine($"{x}>=1 || {x} <=8: {x >= 1 || x <= 8}");
//1******8*10 10>=1 or 10<=8 true or false:True
x = 0;
//0 1******8 0>=1 or 0<=8 false or true: True
Console.WriteLine($"{x}>=1 || {x} <=8: {x >= 1 || x <= 8}");
}
}
Master C# Programming: From Basics to Advanced Techniques
Are you eager to become a proficient C# programmer? Whether you're a complete beginner or looking to sharpen your skills, our comprehensive C# course on Udemy is designed to guide you through the essentials to advanced concepts with ease and clarity.
Why Choose This Course?
Structured Learning Path: Our curriculum is meticulously crafted to take you step-by-step through the learning process, ensuring you build a solid foundation before diving into more complex topics.
Hands-on Coding Exercises: Practice makes perfect! Each lecture includes practical coding exercises that help you apply what you've learned immediately, solidifying your understanding and boosting your confidence.
Real-world Applications: Learn by doing. You'll work on real-life coding problems, from creating your first C# program to exploring advanced techniques like method relationships and using the .NET Framework.
What Will You Learn?
Picture yourself sitting at your computer, confidently typing lines of code that bring your ideas to life on the screen. Here’s what you’ll master:
Basics: Start from scratch with lectures on installing Visual Studio, adjusting font sizes, and writing your first lines of code.
Core Programming Concepts: Understand and implement essential C# concepts, such as variables, data types, operators, and control flow.
Advanced Techniques: Dive deeper into method relationships, class structures, and the .NET Framework, making your code more efficient and manageable.
Practical Projects: Apply your skills to solve real-world problems, like calculating area and perimeter, using PI from the Math class, and parsing integers from strings.
Course Breakdown
Section 1: Basics
Learn the fundamentals of C# and get hands-on with exercises in every lecture.
Topics include creating your first C# program, displaying text, adjusting font sizes, and understanding method relationships.
Section 2: Math Basics
Focus on mathematical operations in C#, from basic arithmetic to complex calculations.
Exercises include integer arithmetic, order of operations, using the Math class, and parsing numbers from strings.
Section 3: Advanced Techniques
Explore advanced programming concepts and improve your coding efficiency.
Topics cover logical operators, comparisons, boolean values, and using format specifiers in strings.
Section 4: Quizzes and Practice Tests
Test your knowledge with quizzes and practice tests designed to reinforce your learning.
Topics range from basics to more challenging concepts, ensuring you're well-prepared for real-world coding challenges.
Enroll Today!
Visualize yourself solving complex coding challenges with ease, your screen displaying the results of your efficient and elegant code. See yourself progressing through each lesson, your confidence growing as you master new skills. Take the first step towards achieving your goals. Enroll in our course today and start your journey to becoming a skilled and confident C# developer. Whether you're looking to advance your career or embark on a new hobby, our course provides the tools and knowledge you need to succeed.