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

2

Comments

  • heres mine

    using System;


    namespace variables

    {

    class Program

    {

    static void Main(string[] args)

    {

    Console.BackgroundColor = ConsoleColor.Black;

    Console.ForegroundColor = ConsoleColor.DarkGreen;


    double num_1;

    double num_2;

    double num_3;


    Console.Write("Averageinator 2000, select your 1st number: ");


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


    Console.Write("insert your second number: ");


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


    Console.Write("insert the third and final number: ");


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


    double result = num_1 + num_2 + num_3 / 3;

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


    // wait before closing

    Console.ReadKey();

    }

    }

    }

  • kyp200455kyp200455 Member
    edited September 2020


  • I did it ;DDD

    using System;


    namespace Best_Program

    {

        class Program

        {

            static void Main(string[] args)

            {  

                double num01;

                double num02;

                double num03;


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


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


                Console.WriteLine ("Input a second number: ");


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


                Console.WriteLine ("Input a third number: ");


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


                double avarage = (num01 + num02 + num03) / 3;


                Console.WriteLine("The avarage of these numbers is " + avarage);


                

                // average = (x + y + z) / 3

                Console.ReadKey();

            }

        }

    }

    😪

  • using System;
    
    
    namespace apprentissage_c__challenge_2
    {
        class Program
        {
            static void Main(string[] args)
            {
                // all variables
    
    
                double num01;
                double num02;
                double num03;
                double sum;
                double finalResult;
    
    
                // the code for the program
    
    
                Console.ForegroundColor = ConsoleColor.DarkBlue;
                Console.BackgroundColor = ConsoleColor.White;
                Console.WindowHeight = 35;
                Console.Title = "challenge number 02";
    
    
                Console.WriteLine("hello, i'm going to calculate the average of the three numbers you put in");
    
    
                Console.ForegroundColor = ConsoleColor.DarkBlue;
                Console.BackgroundColor = ConsoleColor.White;
    
    
                Console.WriteLine("give me the first number, please.");
    
    
                Console.ForegroundColor = ConsoleColor.White;
                Console.BackgroundColor = ConsoleColor.Black;
    
    
                num01 = Convert.ToDouble ( Console.ReadLine() );
    
    
                Console.ForegroundColor = ConsoleColor.DarkBlue;
                Console.BackgroundColor = ConsoleColor.White;
    
    
                Console.WriteLine("give me the second number, please.");
    
    
                Console.ForegroundColor = ConsoleColor.White;
                Console.BackgroundColor = ConsoleColor.Black;
    
    
                num02 = Convert.ToDouble ( Console.ReadLine() );
    
    
                Console.ForegroundColor = ConsoleColor.DarkBlue;
                Console.BackgroundColor = ConsoleColor.White;
    
    
                Console.WriteLine("give me the last one now, please.");
    
    
                Console.ForegroundColor = ConsoleColor.White;
                Console.BackgroundColor = ConsoleColor.Black;
    
    
                num03 = Convert.ToDouble ( Console.ReadLine() );
    
    
                sum = ( num01 + num02 + num03 );
    
    
                finalResult = sum / 3;
    
    
                Console.ForegroundColor = ConsoleColor.DarkBlue;
                Console.BackgroundColor = ConsoleColor.White;
    
    
                Console.WriteLine("the result is: " + finalResult + " ,have a nice day");
    
    
                Console.ReadKey();
            }
        }
    }
    
    
    
  • This is my result.

  • using System;
    
    namespace Challenge_2
    {
        class Program
        {
            static void Main(string[] args)
            {
                float num01;
                float num02;
                float num03;
    
               Console.Write("Input a number: ");
               num01 = Convert.ToSingle( Console.ReadLine() );
    
               Console.Write("Input a second number: ");
               num02 = Convert.ToSingle( Console.ReadLine() );
    
               Console.Write("Input a third number: ");
               num03 = Convert.ToSingle( Console.ReadLine( ) );
    
               float result = (num01 + num02 + num03) / 3;
               Console.WriteLine("The result is " + result);
    
               //wait before closing it
                Console.ReadKey();
    
            }
        }
    }
    
  • This is mine 😅

    using System;


    namespace Learning_to_code_C_

    {

        class Program

        {

            static void Main(string[] args)

            {

                double num01;

                double num02;

                double num03;

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

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

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

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

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

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

                double FirstStep = num01 + num02 + num03;

                Console.WriteLine("The answer is " + FirstStep / 3 );


                Console.ReadKey();

            }

        }

    }

  • using System;


    namespace Test

    {

        class Program

        {

            static void Main(string[] args)

            {

                Console.Title = ("Test");

                Console.ForegroundColor = ConsoleColor.Green;

                Console.WindowHeight = (30);


                double num1;

                double num2;

                double num3;


                Console.WriteLine("ghi Mot so bat ki:");

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


                Console.WriteLine("Ghi mot so bat ki lan nua:");

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

                

                Console.WriteLine("Ghi mot so bat ki lan nua nua:");

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


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


                Console.WriteLine("Dap An La: " + Dap_an);


                Console.ReadKey();


            }

        }

    }


    i did it

  • using System;


    namespace _4

    {

        class Program

        {

            static void Main(string[] args)

            {

                Console.Title = "Variables.test";

                Console.ForegroundColor = ConsoleColor.Yellow;

                Console.WindowHeight = 20;


                double num01;

                double num02;

                double num03;


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

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


                Console.Write("Input second number ");

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


                Console.Write("Input Third number ");

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


                double result = (num01 + num02 + num03) /3;

                Console.WriteLine("The average of these numbers is " + result + "\nPress any key to exit.");


                Console.ReadKey();

            }

        }

    }

  • Wanted To Save On Desirable 24-Hour Ac Repair Atlanta Service? Call Us Now!

    If you wanted to save desired amount on the HVAC Repair In Georgia then you need to connect with us instantly as we provides the best and quick heating & air conditioning solutions with in pocket friendly rates. We are proud to offer you the easily customizable services as we have the genuine experience and only work to deliver you the unmatchable support and satisfacction. All our Air Conditioning Repair Atlanta technicians have the equipment’s which are reliable and used to enhance the performance and resolve issues of your HVAC systems. Additionally we provide solutions round the clock as our professional technicians are present on even in the odd hours at our helpdesk.

    Some of our Air Conditioning Repair Atlanta benefits you get when you out to us:

    ·        24*7 operational helpdesk.

    ·        Certified and licensed technicians.

    ·        Upfront charges,

    ·        Same day inspections.

    Best Hvac Companies In Atlanta

     Hvac Companies In Georgia 

    Heating Atlanta   

    Hvac Repair In Georgia

  • Services Which Make Trusted Captain- Best HVAC Companies In Columbus Ohio?

    There are various components placed in your HVAC systems and when these components get affected they indirectly affect your peace of mind as you are unable to get the perfect comfort & temperature at your home or office. When you dial our Columbus Heating And Cooling helpdesk number we diagnose, inspect and then repair your installed HVAC systems with utmost care & cost-effective approach. We have the best suited 24*7 operational helpline number for both commercial & residential individuals as emergencies can arise anytime and getting them resolved in mandatory.

    Some of our services are listed which make us prominent HVAC Companies Columbus Ohio:

    ·        Ducted or ductless HVAC systems installation & repairs.

    ·        Thermostats repairing & installations.

    ·        Installation & tune-ups of furnaces & boilers.

    ·        Ventilation systems repairing, installations.

    ·        And many more.

    Best Hvac Companies In Columbus Ohio        Hvac Repair Ohio  

    Hvac Companies Columbus Ohio       Residential Hvac Company Ohio

     hvac columbus ohio   air conditioner repair columbus ohio  columbus heating and cooling   hvac companies columbus ohio

    HVAC replacement ohio

    hvac dayton ohio

    heating and air dayton ohio heating and cooling columbus ohio

  • Air Conditioning Repair Near Me Services You Can Expect From Us Round The Clock!

    HVAC systems have some vulnerable parts which need to be work perfectly as if they are not then they can directly affect life & performance of your HVAC systems. If you already wasted your time in searching for the HVAC Replacement Near Me services then don’t get tensed make a call on our helpline number and we offer you the most amazing services at your desired place quickly. 

    For your reference we mentioned some of our services:

    ·        Installation & maintenance of furnaces & thermostats.

    ·        Heating systems installations.

    ·        Air quality inspection & ventilation installation services.

    ·        Air conditioning systems installations & maintenance.

    ·        And much more.

    HVAC Repair Jersey City   

    Best HVAC Companies In NJ

    Heating Jersey City

    HVAC Jersey City NJ  

  • Why You Need To Dial Our Helpline Number Rather Than Searching For The HVAC Repair Services Near Me?

    As a trusted name in offering the most affordable heating and cooling solutions whether for your commercial or residential systems we have the genuine, reliable and cost-oriented services. Our experts are consistently chosen by most of the home or business owners as apart from repairing we also proficient in delivering the most genuine maintenance and installation services as well. So don’t waste your time internet by searching for the HVAC Repair Services Near Me just pick up your phone and speak to our experts to get the exceptional services quickly.

    HVAC service near me HVAC Near Me    HVAC Repair Near Me     HVAC Companies Near Me   HVAC Replacement Near Me      HVAC Maintenance Near Me      HVAC Repair Services Near Me

    hvac services , hvac installation, air conditioning services, air conditioning repair, ac repair, ac service, hvac repair, heating and air conditioning, air conditioning installation, air conditioning repair near me,

    air conditioning repair near me

  • There's no activity in this forum but here's my solution OwO            


    //Calculator


                double num01;

                double num02;

                double num03;


                Console.ForegroundColor = ConsoleColor.Green;

                Console.WriteLine("Mini Average Calculator");


                Console.ForegroundColor = ConsoleColor.Cyan;

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

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


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

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


                Console.Write("Input yet another number: ");

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


                double result = (num01 + num02 + num03) / 3;


                Console.WriteLine("Result returned when numbers are averaged = " + result);

  • Here is mine:

                using System;


    namespace Project1

    {

        class Program

        {

            static void Main(string[] args)

            {

                Console.Write("Input a number ");

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

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

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

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

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

                Console.Write("The result is: " +((num1+num2+num3)/3));

                Console.ReadKey();

            }

        }

    }

  • using System;


    namespace c__code

    {

        class Program

        {

            static void Main(string[] args)

            {

                double num01;


                double num02;


                double num03;


                Console.Title = "Average";


                Console.WriteLine("Enter The First Num01");

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


                Console.WriteLine("Enter The First Num02");

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


                Console.WriteLine("Enter The First Num03");

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


                double result = ((num01 + num02 + num03) / 3);


                Console.ForegroundColor = ConsoleColor.DarkMagenta;

                Console.WriteLine("The Average of Three Numbers Is" + result);



                Console.ReadKey();

            }

        }

    }

  • So at first i got it wrong because I didn't insert brackets, but then i re watched the video and came up with this:


    using System;


    namespace find_Average_out_of_3

    {

        class Program

        {

            static void Main(string[] args)

            {

                Console.Title = "Average calculator(out of 3)";


                

                double num01;

                double num02;

                double num03;


                Console.Write("Put in a first number: ");

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


                Console.Write("Put in a second number: ");

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


                Console.Write("Put in a third number to find the average: ");

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


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


                Console.WriteLine("The average is: " +average);


                Console.ReadKey();

            }

        }

    }

  • PSN45PSN45 Member

    using System;


    namespace amazing_cool_thing_do_not_peek

    {

        class Program

        {

            static void Main(string[] args)

            {


                double num01;

                double num02;

                double num03;

                

                Console.ForegroundColor = ConsoleColor.DarkGreen;

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

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


                Console.ForegroundColor = ConsoleColor.DarkGreen;

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

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

                

                Console.ForegroundColor = ConsoleColor.DarkGreen;

                Console.Write("Now finally, input a final number.");

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

                

                Console.ForegroundColor = ConsoleColor.DarkGreen;

                double addition = num01 + num02 + num01;

                double result = addition / 3;


                Console.ForegroundColor = ConsoleColor.DarkGreen;

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



                Console.ReadKey();


            }

        }

    }

  • Mo_Mo_ Member
    edited April 2021

    Heres my solution!

    {

                 // gets vars

                 int x;

                 int y;

                 int z;

                 //Get Numbers

                 Console.Write("Input a number so i can calculate the average: ");

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

                 

                 Console.Write("Input a second number so i can calculate the average: ");

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

                 

                 Console.Write("Input a third number so i can calculate the average: ");

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


                 // final calculation

                 int result = (x + y + z) / 3;

                 Console.WriteLine("The average of those 3 numbers is " + result);

                

                // Wait before closing

                Console.ReadKey();

            }

        }

    }


    The file incase somebody needs it:


  • using System;


    namespace lil_nigs_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 second number: ");

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


                //Get Third Number

                Console.Write("Input third Number: ");

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


                // Calculate and Display The average

                double result = (num01 + num02 + num03) / 3;

                Console.WriteLine("The average of These number is " + result);


                // Wait before closing

                Console.ReadKey();

            }

        }

    }

  • NexNex Member

    Assignment2:

    using System;
    
    namespace C__Assignment2
    {
        class Program
        {
            static void Main(string[] args)
            {
                //Creating Variables
                int num01, num02, num03, average;
                //Editing Console title
                Console.Title = "Average-inator";
                //Changing Text Color
                Console.ForegroundColor = ConsoleColor.Magenta;
    
                //Taking inputs for variables
                Console.Write("Enter the first number: ");
                num01 = Convert.ToInt32( Console.ReadLine() );
                Console.Write("Enter the second number: ");
                num02 = Convert.ToInt32( Console.ReadLine() );
                Console.Write("Enter the third number: ");
                num03 = Convert.ToInt32( Console.ReadLine() );
                
                //Calculating average
                average = (num01 + num02 + num03) / 3;
                Console.WriteLine("The Average of 3 Numbers is: " + average);
    
    
                //Wait before closing
                Console.ReadKey();
            }
        }
    }
    
    
  • nofoolnofool Member
    using System;
    
    
    namespace My_Awesome_Program
    {
        class Program
        {
            static void Main(string[] args)
            {
                double num1;
                double num2;
                double num3;
                double avgResult;
    
    
                Console.WriteLine("Whats your first number?");
                num1= Convert.ToDouble(Console.ReadLine());
                Console.WriteLine("Whats the number you would like to add to the first?");
                num2 = Convert.ToDouble(Console.ReadLine());
                Console.WriteLine("Whats another number you would like to add to the first?");
                num3 = Convert.ToDouble(Console.ReadLine());
                avgResult = (num1+num2+num3)/3;
                Console.WriteLine("Your average is : " + avgResult);
    
    
                Console.ReadKey();
            }
        }
    }
    
  • NearNear Member

    I did this

    using System;


    namespace Programs

    {

      class Program

      {

        static void Main(string[] args)

        {

           

          Console.WriteLine("Input a number");

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

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

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

          Console.WriteLine ("Input a last number");

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

          var result = number01 + number02 + number03 /3;

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

          Console.ReadKey();
















        }

      }

    }

  • AlexDAlexD Member

    This is my resolution

    using System;


    namespace Code

    {

        class Program

        {

            static void Main(string[] args)

            {

            //variables

            double num01;

            double num02;

            double num03;


            //customization


            Console.ForegroundColor = ConsoleColor.DarkCyan;


            //process


            Console.Write("Input the first number\n");


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


            Console.Write("Input the second number\n");


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


            Console.Write("Input the third number\n");


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


            //final 


            Double answer = (num01 + num02 + num03) / 3;


            //result

            

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

            Console.ReadKey();


            }

        }

    }

  • Hi there


    Why can i not use

    var num01;


    does someone know?🐋

  • NiceSlice66NiceSlice66 Member
    edited August 2021

    I'm a beginner, but I tried my best.


    Code:

    using System;


    namespace Programming_Lesson_2

    {

        class Program


        {

            static void Main(string[] args)

            {


            

             double num01;

             double num02;

             double num03;

             double totalNumbers = 3;


             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) / totalNumbers;

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


                Console.ReadKey();

                

            }

        }

    }

  • using System;


    namespace Variables

    {

        class Program

        {

            static void Main(string[] args)

            {

            //Declare Variables//


            double num01;

            double num02;

            double num03;


            //TEST//

            Console.ForegroundColor = ConsoleColor.Red;

            Console.Write("Input your First Number: ");

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


            Console.ForegroundColor = ConsoleColor.Green;

            Console.Write("Input your Second Number: ");

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

            

            Console.ForegroundColor = ConsoleColor.White;

            Console.Write("Input your Third Number: ");

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


            double result;


            result = num01 + num02 + num03 / 3;

            Console.WriteLine("Final Result is: " +result);


            //Wait before Closing//

            Console.ReadKey();

            


            }

        }

    }


    That's my Code Guys i did my best i know it's almost the same but i hope it's good :)

  • My Solution to Challenge 2:

    using System;


        namespace yeet_le_program

    {

        class challenge2

        {

            static void Main(string[] args)

            {

                double x;

                double y;

                double z;


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

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


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

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


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

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


                double a = (x+y+z)/3;


                Console.WriteLine("Average of these 3 thumbers is: "+a);


                Console.ReadKey();

           

            }

        }

    }

  • using System;
    using System.Collections.Generic;
    using System.Linq;
    
    
    namespace MyApp // Note: actual namespace depends on the project name.
    {
        public class Program
        {
            public static void Main(string[] args)
            {
                // Title
                Console.Title = "Average of 3 numbers";
    
    
                // Declaring variables
                double num1;
                double num2;
                double num3;
                double result;
    
    
                // First number
                Console.Write("Input the first number: ");
                num1 = Convert.ToDouble( Console.ReadLine() );
    
    
                // Second number
                Console.Write("Input the second number: ");     
                num2 = Convert.ToDouble( Console.ReadLine() );
    
    
                // Third number
                Console.Write("Input the third number: ");
                num3 = Convert.ToDouble( Console.ReadLine() );
    
    
                // Result
                result = (num1 + num2 + num3) / 3;
                Console.WriteLine("The average of the 3 numbers is " + result);
    
    
                // Wait for input
                Console.ReadKey();
            }
        }
    }
    
  • using System;


    namespace Code_Relearn_Camp

    {

        class Program

        {

            static void Main(string[] args)

            {

                double num1;

                double num2;

                double num3;


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


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


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


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


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


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


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


                Console.WriteLine("The average of the three absolutely chad like number you put in is " + sol);


                Console.ReadKey();

                //To make sure that this doesn't close immediately.


            }

        }

    }

Sign In or Register to comment.