Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

BRACKEYS - Solution to C# Tutorial 02 Challenge

BrackeysBrackeys Administrator

Hey everyone!

Here is my solution to the challenge from the C# Tutorial 02 (Variables) video that is out this Sunday.

Have fun with it! 😀

using System;


namespace My_Awesome_Program
{
    class Program
    {
        static void Main(string[] args)
        {
            // Declare variables
            double num01;
            double num02;
            double num03;


            // Get first number
            Console.Write("Input a number: ");
            num01 = Convert.ToDouble(Console.ReadLine());


            // Get second number
            Console.Write("Input a second number: ");
            num02 = Convert.ToDouble(Console.ReadLine());


            // Get third number
            Console.Write("Input a third number: ");
            num03 = Convert.ToDouble(Console.ReadLine());


            // Calculate and display the average
            double result = (num01 + num02 + num03) / 3;
            Console.WriteLine("The average of these numbers is " + result);


            // Wait before closing
            Console.ReadKey();
        }
    }
}


«1

Comments

  • I also did it

    using System;
    using System.Collections.Generic;
    using System.Text;
    
    
    namespace cOURSE
    {
        class Program
        {
           static void Main(string [] args)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Title = "Brackeys Average Tutorial";
    
    
                Console.WriteLine("Give a Number for me to average: ");
                Console.ForegroundColor = ConsoleColor.White;
                int num1 = Convert.ToInt32( Console.ReadLine());
    
    
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Give the second Number for me to average: ");
                Console.ForegroundColor = ConsoleColor.White;
                int num2 = Convert.ToInt32(Console.ReadLine());
    
    
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Give the Third Number for me to average: ");
                Console.ForegroundColor = ConsoleColor.White;
                int num3 = Convert.ToInt32(Console.ReadLine());
    
    
                int finalNum = num1 + num2 + num3;
                finalNum = finalNum / 3;
    
    
                Console.WriteLine();
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("The Result is "+finalNum);
    
    
                Console.ForegroundColor = ConsoleColor.White;
                Console.ReadKey();
            }
        }
    }
    
    
    


  • ShadowGamingShadowGaming Member
    edited June 2020

    Did I went too far?

    using System;
    
    namespace Brackeys_Cs_Tutorial
    {
    	internal static class Episode2
    	{
    		private static void Main(string[] args)
    		{
    			// Setting up the Console
    			Console.BackgroundColor = ConsoleColor.Black;
    			Console.ForegroundColor = ConsoleColor.Cyan;
    			Console.Title = "Average";
    
    			Console.Write("How many Number do you want to Average: ");
    			double[] numbers = new double[Convert.ToInt32(Console.ReadLine())];
    			Console.WriteLine();
    
    			AskNumbers(numbers);
    
    			Console.WriteLine("\nAverage is: " + Average(numbers));
    
    			// Stopping Console from instantly closing
    			Console.Read();
    		}
    
    		/// <summary>Asks User to Input some Numbers</summary>
    		/// <param name="numbers">An Array of Number</param>
    		private static void AskNumbers(double[] numbers)
    		{
    			for (int loop1 = 1; loop1 <= numbers.Length; loop1++)
    			{
    				switch (loop1)
    				{
    					case 1:
    						Console.Write("Enter " + loop1 + "st Number: ");
    						break;
    					case 2:
    						Console.Write("Enter " + loop1 + "nd Number: ");
    						break;
    					case 3:
    						Console.Write("Enter " + loop1 + "rd Number: ");
    						break;
    					default:
    						Console.Write("Enter " + loop1 + "th Number: ");
    						break;
    				}
    
    				numbers[loop1 - 1] = Convert.ToDouble(Console.ReadLine());
    			}
    		}
    
    		/// <summary>Takes Array of Numbers and Averages them</summary>
    		/// <param name="numbers">An Array of Number that you want to Average</param>
    		/// <returns>Returns a Averaged out Number</returns>
    		private static double Average(double[] numbers)
    		{
    			double average = new double();
    
    			for (int loop2 = 0; loop2 < numbers.Length; loop2++)
    			{
    				average += numbers[loop2];
    			}
    
    			return average / numbers.Length;
    		}
    	}
    }
    


  • Hey there all! Here's my answer to challenge #2...

    using System;
    
    namespace myAwesomePrograms
    {
         class Average
         {
              static void Main (string[] args)
              {
                   Console.ForegroundColor = ConsoleColor.Red;
                   Console.Title = "Skynet";
    
                   double x;
                   double y;
                   double z;
                   
                   Console.Write("Input the first number: ");
                   x = Convert.ToInt32( Console.ReadLine() );
                   
                   Console.Write("Input the second number: ");
                   y = Convert.ToInt32( Console.ReadLine() );
                   
                   Console.Write("Input the third number: ");
                   z = Convert.ToInt32( Console.ReadLine() );
                   
                   int avg = (x * y * z)/3;
                   Console.WriteLine("The average of them is " + avg + " ...");
                   
                   //Waiting before closing
                   Console.ReadKey();
              }
         }
    }
    
  • MRWitherMRWither Member
    edited June 2020


  • I made this program in phone and by mistake posted it in the challenge 03 but its fine.






    using System;


    namespace JAIVINs_PROGRAM

    {


      public static class Program 

      {

        public static void Main() 

        {

         double num02;

         double num03;

         double num01;

         double average;

         Console.WriteLine("This is a average calculator enter your number to prceed");

          Console.Write("Enter the first number =>");

          num01 = Convert.ToDouble(Console.ReadLine());

          Console.Write("Enter the second number =>");

          num02 = Convert.ToDouble(Console.ReadLine());

          Console.Write("Enter the third number =>");

          num03 = Convert.ToDouble(Console.ReadLine());

          average = (num01 + num02 + num03) / 3;

          Console.Write("This is the final result =>" + average );

          Console.ReadKey();

        }

      }

    }

  • edited June 2020

    is this ok

  • using System;


    namespace Challenge_2

    {

        class Program

        {

            static void Main(string[] args)

            {

                //Variables

                double num1;

                double num2;

                double num3;

                double Average;


    //--------------------------------------------------------------------------------------------------\\


                //Additional Text

                Console.WriteLine("Enter Three Numbers To Take Out Their Average.\n\n\n");



    //---------------------------------------------------------------------------------------------------\\


                //Assigning Value To Variables

                Console.ForegroundColor = ConsoleColor.Green;

                Console.Write("Enter Your First Number: ");

                Console.ForegroundColor = ConsoleColor.Cyan;

                num1 = Convert.ToDouble( Console.ReadLine() );


                Console.ForegroundColor = ConsoleColor.Green;

                Console.Write("Enter Your Second number: ");

                Console.ForegroundColor = ConsoleColor.Cyan;

                num2 = Convert.ToDouble( Console.ReadLine() );


                Console.ForegroundColor = ConsoleColor.Green;

                Console.Write("Enter Your third number: ");

                Console.ForegroundColor = ConsoleColor.Cyan;

                num3 = Convert.ToDouble( Console.ReadLine() );


    //---------------------------------------------------------------------------------------------------\\


                //calculating The Average Of The Numbers

                Average = (num1 + num2 + num3) / 3;


                //Giving The Answer

                Console.ForegroundColor = ConsoleColor.Yellow;

                Console.WriteLine("The Average Of The Three Numbers Is: " + Average);


    //----------------------------------------------------------------------------------------------------\\


                //Wait Before Closing

                Console.ForegroundColor = ConsoleColor.Gray;

                Console.WriteLine("\n\nPress Any Key To Continue.");

                Console.ReadKey();


            }    

        }

    }

  • can Anyone tell me how to upload the code with colors like Brackeys do??

  • using System;


    namespace _4

    {

        class Program

        {

            static void Main(string[] args)

            {

                Console.Title = "BeanOS#2";


                Console.WriteLine("Hi I am Bean2OS. What is your name?");

                string dyson = Console.ReadLine();


                Console.WriteLine($"\nHow are you doing {dyson}");

                 Console.ReadLine();


                // you can declare some string and then equate it toa readline so that the console notices you senpai

                

                Console.WriteLine("\nThat is great to hear");

                Console.ReadLine();


                double uno;

                 double deus;

                  double tres;


                Console.WriteLine("\nI'm going to do some mathematical magic\nready?");

                 Console.ReadLine();


                Console.Write($"\nCan i get your first number {dyson}: ");

                uno = Convert.ToDouble( Console.ReadLine()); 


                Console.Write($"\nCan i get your second number {dyson}: ");

                deus = Convert.ToDouble( Console.ReadLine());  


                Console.Write($"\nCan i get your third number {dyson}: ");

                tres = Convert.ToDouble( Console.ReadLine());    


                Console.WriteLine($"\nThank you for your input {dyson}");  

                 Console.ReadLine();


                double endgame = (uno*deus*tres)/3;   


                Console.WriteLine($"\nHere is the result of your calculation {endgame}.");    

                 Console.ReadLine();          

                

                Console.WriteLine("My trick was simple.\nAll I did was take your numbers\nmultiply them \nand find the average");

                 Console.ReadLine();        


                Console.WriteLine("\nRemember to have a good day and smile.\n Good Day");   



            Console.ReadKey();

            }

        }

    }

  • BlueBlue Member

    This took me less than 5 minuets to make. I also like to give my projects personality.


    using System;


    namespace Program_1._1

    {

        class Program

        {

            static void Main(string[] args)

            {

                // This text is useless


                Console.Title = "The Mystery Program";

                Console.ForegroundColor = ConsoleColor.Cyan;


                double num01;

                double num02;

                double num03;


                Console.WriteLine("Welcome to The Mystery Program.\nWhat I do, what I'm named, and what I say may change at any point in time. \nSo \n. \n. \n. \nWhat is your name?");

                string userName = Console.ReadLine();

                

                Console.WriteLine("Hello, " + userName + ", my name is D.O.M. \nShort for Don't Overide Me. \nThis program is a calculator right now. \nI can only average three numbers. \nWhat is the first number you would like?");

                num01 = Convert.ToDouble( Console.ReadLine() );


                Console.WriteLine("You entred " + num01 + "! \nWhat is the second number?");

                num02 = Convert.ToDouble( Console.ReadLine() );


                Console.WriteLine("You entred " + num02 + "\nPlease enter your third number");

                num03 = Convert.ToDouble( Console.ReadLine() );


                Console.WriteLine("You entred " + num03 + "\nYour answer is " + (num01 + num02 + num03) / 3 +"!\nPress any key to close");


                Console.ReadKey();

            }

        }

    }

  • WorthyWorthy Member
    edited June 2020

    Here Is Mine

    using System;
    
    
    
    
    namespace myProject_001
    
    {
    
        class Program
    
        {
    
            static void Main(string[] args)
    
            {
    
                // Console
    
                Console.Title = "Project 001";
    
                Console.ForegroundColor = ConsoleColor.Yellow;
    
                Console.WindowHeight = 50;
    
                
    
                
    
                // User Information
    
                string username;            
    
                double num001;
    
                double num002;
    
                double num003;
    
                
    
                Console.WriteLine("Input Name");
    
    
    
    
                username = Convert.ToString(Console.ReadLine() );
    
    
    
    
                // Calculator Part
    
    
    
    
    
    
    
                Console.Write(username + " Input a number: ");
    
    
    
    
                num001 = Convert.ToDouble(Console.ReadLine() );
    
                
    
                Console.Write("Input a second number: ");
    
    
    
    
                num002 = Convert.ToDouble(Console.ReadLine() );
    
    
    
    
                Console.Write("Input a third number: ");
    
    
    
    
                num003 = Convert.ToDouble(Console.ReadLine() );
    
    
    
    
                // Math Symbol
    
                double result = num001 + num002 + num003;
    
                double finalResult = result/3;
    
                Console.ForegroundColor = ConsoleColor.Green;
    
                Console.WriteLine("The result it " + finalResult + "\n Press Any Key To Close The Application");
    
                // Before Closing
    
                Console.ReadKey();
    
            }
    
        }
    
    }
    
  • edited June 2020

    Here's mine, just wanted to specify that the user can now input any amount of averages ;)



    using System;

    using System.Collections.Generic;


    namespace Brackeys_average

    {

      class Program

      {

        static void Main(string[] args)

        {

          List<double> doubles = new List<double>();


          Console.Write("Input how many numbers you want to average: ");

          int times = (Convert.ToInt32(Console.ReadLine()));



          for(int i = 0; i < times; i++)

          {

            Console.Write("Input a number: ");

            doubles.Add(Convert.ToDouble(Console.ReadLine()));

          }


          double length = doubles.Count;


          double avg = 0;


          for (int i = 0; i < length; i++)

          {

            avg += doubles[i];

          }

          avg /= length;


          Console.WriteLine("Your result is: " + avg);

        }

      }

    }

  • Can somebody help me post my work pls?

  • Victor2111Victor2111 Member
    edited July 2020

    is it ok to post it like that? Also is my first time and im 10 years old so pls corect me if im wrong with something

    using System;


    namespace Primul_program

    {

        class Program

        {

            static void Main(string[] args)

            {

                Console.Title = "Hi";

                Console.ForegroundColor = ConsoleColor.Green ;

                Console.Write("Wanna see a magic trick?");

                double num01;

                double num02;

                double num03;

                Console.Write("Say a number: ");


                num01 = Convert.ToDouble ( Console.ReadLine() );


                Console.Write("Now another one: ");

                num02 = Convert.ToDouble ( Console.ReadLine() );

                Console.WriteLine("And another one.");

                num03 = Convert.ToDouble ( Console.ReadLine() );


                double  result = num01 + num02 + num03 ;

                double finalResult = result/3;

                Console.WriteLine("So i calculated in a way that I will find the average of these three numbers and the average of them is " + finalResult );

                Console.WriteLine("Silly me.I forgot to ask your name.So whats your name?");

                string userName = Console.ReadLine();

                Console.WriteLine("I like the name " + userName +" .It is nice.My name is Andrew.");

                Console.Write("Sooo...what now?");

                Console.Write("Oh i know:a story.");

                Console.WriteLine("Uhm.. so lets say that our hero,named(pst, now you say a name)");

                string heroName = Console.ReadLine();

                Console.WriteLine(heroName + ", I think we can go with that.");

                Console.WriteLine("Now say a location.");

                string placeName = Console.ReadLine();

                Console.WriteLine("Where were we?Oh right.So " + heroName + " is at a place named " + placeName + ".");

                Console.WriteLine("Now im gonna end bc I ran out of imagination.");

                Console.WriteLine("Bye " + userName + ".See?I did not forget your name.");

                

                //wait before close

                Console.ReadKey();


            }

        }

    }

  • BansiBansi Member
    edited July 2020
    using System;
    namespace My_awesomest_Program
    {
        class Program
        {
            static void Main(string[] args)
            { 
    
                Console.Write("Enter the first number: ");    
                double num01 = Convert.ToDouble(Console.ReadLine());
    
                Console.Write("Enter the second number: ");
                double num02 = Convert.ToDouble(Console.ReadLine());
    
                Console.Write("Enter the third number: ");
                double num03 = Convert.ToDouble(Console.ReadLine());
    
                double avg = (num01+num02+num03)/3;
                Console.WriteLine("The average is " + avg + "\nJust press any key");
    
                Console.ReadKey();
    
            }    
    
        }
    
    }
    
    


  • Sooooo.....

    I'm a bit late but....


    And i messed around with the script a bit and I had a Calculator and something that you can calculate the average 3 numbers...


    So here is my script:


    using System;
    
    namespace Text_Based_Adventure
    {
        class Program
        {
            static void Main(string[] args)
            {
                //Important: Define everything
                string options, validOperator;
                double num1, num2, Num1, Num2, Num3;
    
                //Detect what the user whant to do 
                Console.Title = ("Calculator");
                Console.ForegroundColor = ConsoleColor.Blue;
                Console.BackgroundColor = ConsoleColor.White;
                Console.WriteLine("Calculator or Average");
                options = Console.ReadLine();
    
                //If they want the Calculator
                if(options == "Calculator"){
                    //This is why we have eys, right?
                    Console.ForegroundColor = ConsoleColor.White;
                    Console.BackgroundColor = ConsoleColor.Black;
    
                    //The numbers and operators
                    Console.WriteLine("Number1:");
                    num1 = Convert.ToDouble(Console.ReadLine());
                    Console.WriteLine("Number2:");
                    num2 = Convert.ToDouble(Console.ReadLine());
                    Console.WriteLine("Enter a valid operator");
                    validOperator = Console.ReadLine();
    
                    //There are more then 1 oparator, right
                    if(validOperator == "+"){
                        Console.WriteLine(num1 + num2);
                    }
                    else if(validOperator == "-"){
                        Console.WriteLine(num1 - num2);
                    }
                    else if(validOperator == "/"){
                        Console.WriteLine(num1 / num2);
                    }
                    else if(validOperator == "*"){
                        Console.WriteLine(num1 * num2);
                    }
    
                    //Bad boiis not allowed
                    else{
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.BackgroundColor = ConsoleColor.Red;
                        Console.WriteLine("Invalid Operater");
                        Console.ReadKey();
                    }
                }
    
                //If they want the Average
                else if(options == "Average"){
                    //Colors!
                    Console.ForegroundColor = ConsoleColor.White;
                    Console.BackgroundColor = ConsoleColor.Black;
    
                    //The Numbers and dividing it though 3 so you have the average
                    Console.WriteLine("Number1");
                    Num1 = Convert.ToDouble(Console.ReadLine());
                    Console.WriteLine("Number2");
                    Num2 = Convert.ToDouble(Console.ReadLine());
                    Console.WriteLine("Number3");
                    Num3 = Convert.ToDouble(Console.ReadLine());
                    Console.WriteLine((Num1 + Num2 + Num3) / 3);
                }
    
                //If someone want to break the rules
                else{
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.BackgroundColor = ConsoleColor.Red;
                    Console.WriteLine("There Is no option called " + options + ".");
                    Console.ReadKey();
                }
    
                Console.ReadKey();
            }
        }
    }
    


  • HubiHubi Member

    Im not sure how to post it correctly...


    using System;


    namespace AMK

    {

        class Program

        {

            static void Main(string[] args)

            {   

                double num1;

                double num2;

                double num3;


                Console.ForegroundColor = ConsoleColor.Green;

                Console.Write("Zahl einfügen: ");


                num1 = Convert.ToDouble(Console.ReadLine() );


                Console.Write("\nZweite Zahl einfügen: ");


                num2 = Convert.ToDouble(Console.ReadLine() );

                

                Console.Write("\nDritte Zahl einfügen: ");


                num3 = Convert.ToDouble(Console.ReadLine() );


                double Ergebnis = (num1 + num2 + num3) / 3 ;


                Console.ForegroundColor = ConsoleColor.Blue;

                Console.WriteLine("\nDer Durchschnitt ist " + Ergebnis);

               

                

                

                Console.ReadKey();

            }

        }

    }

  • SILithium_DevSILithium_Dev Member
    edited July 2020

    @Hubi and @Victor2111 you can click the "P"-like thing on the left and select "" Quote". There should be a "</> Code Block" under it

    Console.WriteLine("Und da hast du die Farben(There you have it)!")
    Console.WriteLine("I hope I could help you!")
    
  • This is how I did it

    using System;


    namespace Average

    {

        class Program

        {

            static void Main(string[] args)

            {

                Console.Title = "Average";

                Console.ForegroundColor = ConsoleColor.Blue;

                Console.WindowHeight = 40;

                double num01;

                double num02 ;

                double num03;

                double total;

                double result;


                Console.WriteLine("Enter a Number :");

                num01 = Convert.ToDouble( Console.ReadLine() );

                Console.WriteLine("Enter another number :");

                num02 = Convert.ToDouble( Console.ReadLine() );

                Console.WriteLine("Enter another number :");

                num03 = Convert.ToDouble( Console.ReadLine() ); 


                total = num01 + num02 + num03;

                result = total/3;

                Console.WriteLine("The Average of the three numbers is");

                

                Console.WriteLine(result);


            


                Console.ReadKey();

            

            

            }


        }

    }

  • 82_dev82_dev Member

    using System;


    namespace Average_Calculator

    {

        class Program

        {

            static void Main()

            {

                

                double num1;

                double num2;

                double num3;

                double sum;

                double average;

                string restart;


                Console.Title = "Average Calculator";

                Console.ForegroundColor = ConsoleColor.Green;


                Console.Write("Insert the first number:");

                num1 = Convert.ToDouble(Console.ReadLine());


                Console.Write("Insert the second number:");

                num2 = Convert.ToDouble(Console.ReadLine());


                Console.Write("Insert the third number:");

                num3 = Convert.ToDouble(Console.ReadLine());


                sum = num1 + num2 + num3;

                average = sum / 3;


                Console.Write("The Average is " + average);


                Console.Write("\nPress R to restart: ");

                restart = Console.ReadLine();


                if (string.Equals(restart, "R"))

                {

                    Console.Clear();

                    Main();

                }


                if (string.Equals(restart, "r"))

                {

                    Console.Clear();

                    Main();

                }


            }

        }

    }

  • megarenmegaren Member
    edited July 2020

    I used a little simpler way :)


    also multiplied and used int(32) XD

  • DommikDommik Member

    using System;


    namespace My_awesome_project

    {

        class Program

        {

            static void Main(string[] args)

            {

                double  num1;      //all numbers

                double  num2;

                double  num3;

                double  num4 = 3;



                Console.Write("Napiš číslo: ");

                num1 = Convert.ToDouble( Console.ReadLine() ); //first


                Console.Write("Napiš druhé číslo: ");          //second

                num2 = Convert.ToDouble( Console.ReadLine() );


                Console.Write("Napiš poslední číslo: ");       //third

                num3 = Convert.ToDouble(Console.ReadLine() );


                double  result = num1 + num2 + num3 ;          //result

                Console.WriteLine("Tady je výsledek: " + result / num4 );

               


                Console.ReadKey(); //close

            }

        }

    }

  • MrDarkTimeMrDarkTime Member
    edited July 2020

    Ye, it was pretty easy. Code:


    using System;


    namespace VSCODEPROJ

    {

        class Program

        {

            static void Main(string[] args)

            {

                Console.Title = "Average Meter (4 Numbers Edition)";

                Console.ForegroundColor = ConsoleColor.Cyan;

                Console.WindowHeight = 35;


                double no1;

                double no2;

                double no3;

                double no4;

                

                Console.WriteLine("What is the first number???");

                no1 = Convert.ToDouble( (Console.ReadLine() ));


                Console.WriteLine("What is the second number???");

                no2 = Convert.ToDouble( (Console.ReadLine() ));


                Console.WriteLine("What is the third number???");

                no3 = Convert.ToDouble( (Console.ReadLine() ));


                Console.WriteLine("What is the fourth / last number???");

                no4 = Convert.ToDouble( (Console.ReadLine() ));


                // add how much you want




                double result = (no1 + no2 + no3 + no4) / 4;


                Console.WriteLine("The average beetween this 4 numbers is " + result);

                Console.ForegroundColor = ConsoleColor.Yellow;

                Console.WriteLine("Press any key to exit...");

                Console.ReadKey();


                // Made by MrDarkTime. Please don't try to copy this. It's bad.


            }

        }

    }

  • This is how I did mine

    using System;


    namespace Awesome_Program

    {

        class Program

        {

            static void Main(string[] args)

            {

                double num01;

                double num02;

                double num03;



                Console.Write("Input a number: ");

                num01 = Convert.ToDouble( Console.ReadLine() );


                Console.Write("Input a second number "); 

                num02 = Convert.ToDouble( Console.ReadLine() );


                Console.Write("Input a third number ");

                num03 = Convert.ToDouble( Console.ReadLine() );

                

                double result = num01 + num02 + num03;

                double average = result / 3;

                Console.WriteLine("The average of the numbers is " + average);


                // Wait before closing

                Console.ReadKey();

            }

        }

    }

  • meshalmeshal Member

    using System;


    namespace My_First_Code

    {

      class Program

      {

        static void Main(string[] args)

        {


          int num1;

          int num2;

          int num3;


          Console.Write("write number1: ");


          num1 = Convert.ToInt32( Console.ReadLine() );


          Console.Write("write number2: ");


          num2 = Convert.ToInt32(Console.ReadLine() );


          Console.Write("write number3: ");


          num3 = Convert.ToInt32(Console.ReadLine());

          int result = (num1 + num2 + num3) / 3;

          Console.WriteLine("the result is " + result);


          // the end

          Console.ReadKey();

        }

      }

    }

  • using System;
    
    
    namespace Awesome_Projects
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.Title = "FRIDAY";
                
                double num01;
                double num02;
                double num03;
    
    
                Console.Write("Enter 1st number: ");
                num01 = Convert.ToDouble(Console.ReadLine());
    
    
                Console.Write("Enter 2nd number: ");
                num02 = Convert.ToDouble(Console.ReadLine());
    
    
                Console.Write("Enter 3rd number: ");
                num03 = Convert.ToDouble(Console.ReadLine());
    
    
                double avg = (num01+num02+num03)/3;
    
    
                Console.WriteLine("The average is: "+ avg);
    
    
                Console.ReadKey();
            }
        }
    }
    
    
    
  • using System;


    namespace _4

    {

        class Program

        {

            static void Main(string[] args)

            {

                Console.BackgroundColor = ConsoleColor.DarkGray;


                Console.Title = "Can i still code?";

                

                string yos = "jormagund";


                double a;

                double b;

                double c;


                Console.Write("gimme a number any number :");

                 a = Convert.ToDouble( Console.ReadLine());


                Console.Write("nexxxxt number:");

                 b = Convert.ToDouble(Console.ReadLine()) ;


                  Console.Write("nexxxxt number:");

                 c = Convert.ToDouble(Console.ReadLine()) ;



                Console.WriteLine("hey i really like this word "+yos);

                Console.ReadLine();


                Console.WriteLine("imma add these numbers ... and do some other stuff widit");

                Console.ReadLine();


                 double d = (a+b+c)/3 ;


                  

                  

                 Console.WriteLine("here's your average"+d);



              Console.ReadKey();

            }

        }

    }

  • Here is my solution to the challenge:


  • Double num1;

               Double num2;

               Double num3;


                //Input Number 1

                Console.Write("Input no.1: ");

                num1 = Convert.ToDouble(Console.ReadLine());


                //Input Number 2

                Console.Write("Input no.2: ");

                num2 = Convert.ToDouble(Console.ReadLine());


                //Input Number 3

                Console.Write("Input no.3: ");

                num3 = Convert.ToDouble(Console.ReadLine());


                Double add = num1 + num2 + num3;

                Double result = add / 3;


                Console.WriteLine("The Average is " + result );

     Console.ReadKey();

Sign In or Register to comment.