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

13»

Comments

  • int num01;
    int num02;
    int num03;
    
    
    Console.Write("imput a number: ");
    
    
    num01 = Convert.ToInt32( Console.ReadLine() );
    
    
    Console.Write("imput a second number: ");
    
    
    num02 = Convert.ToInt32( Console.ReadLine() );
    
    
    Console.Write("imput a third number: ");
    
    
    num03 = Convert.ToInt32 ( Console.ReadLine() );
    
    //Averege
    int num04 = 3;
    
    //Resul
    int result = num01 + num02 + num03;
    int averege = result / num04;
    
    
    
    Console.WriteLine("The average between " + num01 + "+" + num02 + "+" + num03 + " is: " + averege);
    
    
    //Exit
    Console.ReadKey();
    
    //I'm a bit late...
    
  • KurRupptedKurRuppted Member
    edited December 2021

    KurRuppted (press f5 to run)


    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)

    {

    //variables

    double num01;

    double num02;

    double num03;

    double result01;

    double result02;


    //welcome

    Console.WriteLine("Hello, I will help you find \nthe average of three numbers!");


    //inputs

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

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

    Console.Write("Now Input a SECOND Number: ");

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

    Console.Write("Now Input the LAST Number: ");

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

    // end


    Console.WriteLine("Calculating");

    Console.WriteLine("Please Wait");

    result01 = num01 + num02 + num03;

    result02 = result01 / 3;

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



    Console.ReadKey();

    }

    }

    }




    https://github.com/KurRuppted/Brackey-Challenge-E02-Average-of-three-nums

  • mine:



    using System;


    namespace MyApp // Note: actual namespace depends on the project name.

    {

        internal class Program

        {

       

            static void Main(string[] args)

            {

               double num01;

               double num02;

               double num03;


               Console.Write("input num01: ");

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


               Console.Write("input num02: ");

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


               Console.Write("input num03: ");

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


               double stored = num01 + num02 + num03;


               double awnser = (stored / 3);

               Console.Write("the result is: " + awnser);



              Console.ReadKey(); //wait before closing

            }

        }

    }

  • Seems like it worked!

    using System;


    namespace New_Code

    {

        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 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 result is " + result);


                Console.ReadKey();

            }

        }

    }

  • here's mine


    using System;


    namespace My_Code

    {

        class Program

        {

            static void Main(string[] args)

            {

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


               // Variables

               double num01;

               double num02;

               double num03;


               // Asking for user's input

               Console.WriteLine("Input your first number: ");

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


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

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


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

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

               

               // Getting the average

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

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


               // Wait Before Closing

               Console.ReadKey();  

            }

        }

    }

  • WhizkidWhizkid Member

    So I think this is okay

  • goodguygoodguy Member

    is this good

    using System;

     namespace coding

     {

         class program

         {

             static void Main (string[] args)


             {

                //variables

                double num1;

                double num2;

                double num3;


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

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


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

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


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

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


                var r1 = num1 + num2 + num3;

                var r2 = r1 / 3;

                var result = r2;


                Console.Write("the avrage:" + result);


                Console.ReadKey();

             }

         }

     }

  • Here is my code:

    Here is the outcome:


  • MekseeMeksee Member

    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;

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


    Console.ReadKey();

  • PandoPando Member

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

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


    Console.ReadKey();

Sign In or Register to comment.