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 03 Challenge

BrackeysBrackeys Administrator
edited June 26 in Announcements

Hey everyone!

Here is my solution to the challenge from the C# Tutorial 03 (Conditions) video that is out soon.

Have fun with it! 😀

using System;


namespace My_Awesome_Program
{
    class Program
    {
        static void Main(string[] args)
        {
            int answer;
            
            // First problem
            Console.Write("15 + 2 * 2 = ");


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


            if (answer == 60) {
                Console.WriteLine("Correct!");
            } else {
                Console.WriteLine("Wrong!");
            }


            // Second problem
            Console.Write("10 * 2 / 4 = ");


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


            if (answer == 5) {
                Console.WriteLine("Correct!");
            } else {
                Console.WriteLine("Wrong!");
            }


            // Third problem
            Console.Write("(4 + 3 + 2 + 1) / 2 = ");


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


            if (answer == 6) {
                Console.WriteLine("Correct!");
            } else {
                Console.WriteLine("Wrong!");
            }


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


Comments

  • edited June 29

    i made this code in my phone to calculate the average.





    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();

        }

      }

    }

  • EttoYTEttoYT Member

    My answer to the problem:


    using System;
    
    namespace Math_Quiz
    {
        class Program
        {
            static void Main(string[] args)
            {
                int input;
                
                Console.WriteLine("10 * 7 / 2 = ");
    
    
                input = Convert.ToInt32(Console.ReadLine());
    
    
                if (input == 35) {
                    Console.WriteLine("Correct Answer!");
                } else {
                    Console.WriteLine("Wrong Answer!");
                }
    
                Console.Write("12 + 2 * 2 = ");
    
    
                input = Convert.ToInt32(Console.ReadLine());
    
    
                if (input == 16) {
                    Console.WriteLine("Correct Answer!");
                } else {
                    Console.WriteLine("Wrong Answer!");
                }
    
                Console.ReadKey();
            }
        }
    }
    


  • using System;


    namespace VSCODEPROJ

    {

        class Program

        {

            static void Main(string[] args)

            {

                Console.Title = "Math Challenge";


                Console.WriteLine("1 x 5 + 2 x 5 = ?");


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

                

                

                if (firstResult == 15)

                {

                    Console.WriteLine("Correct!");

                    

                }

                else

                {

                    Console.WriteLine("Incorrect!");

                    

                }


                Console.WriteLine("5 x 5 + 3 + 7 = ?");


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


                if (secondResult == 35)

                {

                    Console.WriteLine("Correct!");

                    

                }

                else

                {

                    Console.WriteLine("Incorrect!");

                    

                }


                Console.WriteLine("Test finished. Press any key to continue...");

                Console.ReadKey();


            }


        }

    }

  • This is how I did it!

    using System;


    namespace Awesome_Program

    {

        class Program

        {

            static void Main(string[] args)

            {

                Console.Title = ("Maths Quiz");

                Console.ForegroundColor = ConsoleColor.DarkCyan;


                Console.WriteLine("What is 10 x 3?");

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


                  if(q1 == 30) {

                    Console.WriteLine("Correct!");

                }else {

                    Console.WriteLine("Incorrect!");

                }


                Console.WriteLine("Mass = 10kg, Acceleration = 10 metres per second find the force");

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


                 if(q2 == 100) {

                    Console.WriteLine("Correct!");

                }else {

                    Console.WriteLine("Incorrect!");

                }


                Console.WriteLine("What is 10 + 2 x 3?");

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


                if (q3 == 16) {

                    Console.WriteLine("Correct!");

                }else {

                    Console.WriteLine("Incorrect!");

                }


                Console.WriteLine("What is 60 + 32");

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


                if (q4 == 92) {

                    Console.WriteLine("Correct!");

                }else {

                    Console.WriteLine("Incorrect!");

                }


                Console.WriteLine("What is 100 x 2 + 8");

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


                if(q5 == 208) {

                    Console.WriteLine("Correct!");

                }else{

                    Console.WriteLine("Incorrect!");

                }


                Console.ForegroundColor = ConsoleColor.Green;

                Console.WriteLine("The quiz has been completed! Press any key to do it over!");


                //Wait before closing

                Console.ReadKey();

            }

        }

    }

  • BashereBashere Member

    This is my solution(please tell me if there's anything I could do to improve it!):

    using System;
    
    
    namespace Learn_C_
    {
        class Program
        {
            static void Main(string[] args)
            {
                //Changing the settings
                Console.Title = "Beef";
                Console.ForegroundColor = ConsoleColor.Green;
    
    
                /*
                Challenge: To do a math quiz with 3 questions.
                WIL: If, Else, and Else If + Switch Case
                */
                
                //Code
                Console.WriteLine("!Welcome to a Simple Math Quiz!");
                int answer;
    
    
                //Question 1
                Console.WriteLine("Q1: 2^2 + 8 * 9:");
                answer = Convert.ToInt16(Console.ReadLine());
    
    
                if(answer == 76)
                {
                    Console.WriteLine("Correct!");
                }
                else
                {
                    Console.WriteLine("Incorrect...");
                }
    
    
                //Question 2
                Console.WriteLine("Q2: 6 - 4( 5 * 8 ):");
                answer = Convert.ToInt32(Console.ReadLine());
    
    
                if(answer == -634)
                {
                    Console.WriteLine("Correct!");
                }
                else
                {
                    Console.WriteLine("Incorrect...");
                }
    
    
                //Question 3
                Console.WriteLine("Q3: 11 * (-5)^2:");
                answer = Convert.ToInt32(Console.ReadLine());
    
    
                if(answer == 275)
                {
                    Console.WriteLine("Correct!");
                }
                else
                {
                    Console.WriteLine("Incorrect...");
                }
    
    
                //Press key to close
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("***Press any key to exit.***");
                Console.ReadKey();
            }
        }
    }
    
  • meshalmeshal Member

    easy

    using System;


    namespace My_First_Code

    {

      class Program

      {

        static void Main(string[] args)

        {

          int ans1;

          int ans2;

          int ans3;


          Console.WriteLine("1+1= ");

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

          if (ans1 == 2)

          {

            Console.WriteLine("correct");

          }

          else

          {

            Console.WriteLine("wrong");

          }


          Console.WriteLine("2+2= ");

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

          if (ans2 == 4)

          {

            Console.WriteLine("correct");

          }

          else

          {

            Console.WriteLine("wrong");

          }


          Console.WriteLine("4+4= ");

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

          if (ans3 == 8)

          {

            Console.WriteLine("correct");

          }

          else

          {

            Console.WriteLine("wrong");

          }

  • sumitsumit Member

    My answer to the problem :



    using System;


    namespace Math_Quiz

    {

        class Program

        {

            static void Main(string[] args)

            {

                Console.Title = "Math Quiz";

                int answer;


                // First Question

                Console.Write("5 * 3 = ");

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


                if (answer == 15) {

                    Console.WriteLine("Correct!");

                } else {

                    Console.ForegroundColor = ConsoleColor.Red;

                    Console.WriteLine("Incorrect!");

                }



                // Second Question

                Console.ForegroundColor = ConsoleColor.Green;

                Console.Write("10 * 2 / 2 = ");

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


                if (answer == 10) {

                    Console.WriteLine("Correct!");

                } else {

                    Console.ForegroundColor = ConsoleColor.Red;

                    Console.WriteLine("Incorrect!");

                }



                // Third Question

                Console.ForegroundColor = ConsoleColor.Green;

                Console.Write("30 + 15 + 5 = ");

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


                if (answer == 50) {

                    Console.WriteLine("Correct!");

                } else {

                    Console.ForegroundColor = ConsoleColor.Red;

                    Console.WriteLine("Incorrect!");

                }



                // wait before closing

                Console.ForegroundColor = ConsoleColor.Red;

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

                Console.ReadKey();

            }

        }

    }

  • I am 12 years old and here's my program.


    using System;


    namespace Conditions

    {

        class Program

        {

            static void Main(string[] args)

            {

                Console.Title = "Math test.";


                int answer;

                int correctAnswers = 0;

                int wrongAnswers = 0;


                Console.ForegroundColor = ConsoleColor.White;

                Console.Write("1. (10 x 2) / 4? ");

                answer = Convert.ToInt16(Console.ReadLine());


                if (answer == 5)

                {

                    Console.ForegroundColor = ConsoleColor.Green;

                    Console.WriteLine("Correct!");

                    correctAnswers += 1;

                }

                else

                {

                    Console.ForegroundColor = ConsoleColor.Red;

                    Console.WriteLine("Wrong!");

                    wrongAnswers += 1;

                }

                

                Console.ForegroundColor = ConsoleColor.White;

                Console.Write("2. 150 x 5 - 10 / 2? ");

                answer = Convert.ToInt16(Console.ReadLine());


                if (answer == 370)

                {

                    Console.ForegroundColor = ConsoleColor.Green;

                    Console.WriteLine("Correct!");

                    correctAnswers += 1;

                }

                else

                {

                    Console.ForegroundColor = ConsoleColor.Red;

                    Console.WriteLine("Wrong!");

                    wrongAnswers += 1;

                }


                Console.ForegroundColor = ConsoleColor.White;

                Console.Write("9 + 1 * 16? ");

                answer = Convert.ToInt16(Console.ReadLine());


                if (answer == 26)

                {

                    Console.ForegroundColor = ConsoleColor.Green;

                    Console.WriteLine("Correct!");

                    correctAnswers += 1;

                }

                else

                {

                    Console.ForegroundColor = ConsoleColor.Red;

                    Console.WriteLine("Wrong!");

                    wrongAnswers += 1;

                }


                Console.WriteLine("You had " + correctAnswers + " correct answer(s) and " + wrongAnswers + " wrong answer(s).");

                

                Console.ReadKey();

            }

        }

    }

  • edited July 18

    Hi Brackeys,

    I am a huge fan of your's.

    I am 14 years old and learned coding through your videos. Thanks for so much good content on your youtube channel.

    I have uploaded a new code down please refer that.

  • EkosuEkosu Member

    Hello Brackeys, je suis 14 years old and i am not good in french.


    using System;


    namespace The_Test_Object

    {

        class Program

        {

            static void Main(string[] args)

            {

                Console.ForegroundColor = ConsoleColor.White;

                Console.BackgroundColor = ConsoleColor.Black;

                Console.Title = "Morning :)";


                        //points


                int score = 3;


                        //problem 01


                Console.WriteLine("What is the awnser to: 2 * 4 + 9 :"); //17

                var awnser = Convert.ToDouble(Console.ReadLine());


                if(awnser == 17){

                    Console.ForegroundColor = ConsoleColor.Green;

                    Console.WriteLine("Good Job");

                }

                else{

                    Console.ForegroundColor = ConsoleColor.Red;

                    Console.WriteLine("Wrong");

                    score = score - 1;

                }

                Console.ForegroundColor = ConsoleColor.White;


                        //problem 02


                Console.WriteLine("What is the awnser to: 90 - 18 / 3 :"); //15

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


                if(awnser == 15){

                    Console.ForegroundColor = ConsoleColor.Green;

                    Console.WriteLine("Good Job");

                }

                else{

                    Console.ForegroundColor = ConsoleColor.Red;

                    Console.WriteLine("Wrong");

                    score = score - 1;

                }

                Console.ForegroundColor = ConsoleColor.White;


                        //problem03


                Console.WriteLine("What is the awnser to: ((29 - 9) / 2 ) * 3 :"); //30

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


                if(awnser == 30){

                    Console.ForegroundColor = ConsoleColor.Green;

                    Console.WriteLine("Good Job");

                    Console.ForegroundColor = ConsoleColor.Green;

                    Console.WriteLine("Your Finale Score = " + score + "/3");

                }

                else{

                    Console.ForegroundColor = ConsoleColor.Red;

                    Console.WriteLine("Wrong");

                    score = score - 1;

                    Console.ForegroundColor = ConsoleColor.Green;

                    Console.WriteLine("Your Finale Score = " + score + ("/3"));

                }

                Console.ForegroundColor = ConsoleColor.White;


                //Close thingy


                Console.ForegroundColor = ConsoleColor.Red;

                Console.WriteLine("--Press a key to exit--");

                Console.ReadKey();

            }

        }

    }

  • edited July 18

    Hi brackeys,

    The code which I uploaded yersterday was not good. So here is the revamped version of the code-

    using System;


    namespace ConsoleApp2

    {

      class Program

      {

        static void Main(string[] args)

        {

          Console.Title = "Math Problems";


          int points = 3;

          Console.WriteLine("Answer some simple math problems");

          Console.Write("Question1. 2*8*2*8:");

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

          if (ans == 256)

          {

            Console.ForegroundColor = ConsoleColor.Green;

            Console.WriteLine("Correct");

            if (ans != 256)

            {

              Console.ForegroundColor = ConsoleColor.Red;

              Console.Write("Oh no you answered wrong. Try again:");

              points = points - 1;

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

              if (ty != 256)

              {

                Console.ForegroundColor = ConsoleColor.Red;

                Console.WriteLine("Oops you answered the question wrong again, you are out.");


              }

              else if (ty == 256)

              {

                Console.ForegroundColor = ConsoleColor.Green;

                Console.WriteLine("YAY the answer is right.");

              }

            }

            Console.Write("First Question was easy. Now Question2.5*6*5*6-300:");

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

            if (ans1 == 600)

            {

              Console.ForegroundColor = ConsoleColor.Green;

              Console.WriteLine("WOW, again a right answer.");

            }

            else if (ans1 != 600)

            {

              Console.ForegroundColor = ConsoleColor.Red;

              Console.WriteLine("Oh no you answered the question wrong. Try again:");

              points = points - 1;

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

              if (ty1 != 600)

              {

                Console.ForegroundColor = ConsoleColor.Red;

                Console.WriteLine("Oops you answered the question wrong again, you are out.");

              }

              else if (ty1 == 600)

              {

                Console.ForegroundColor = ConsoleColor.Green;

                Console.WriteLine("YAY you answered the question right.");

              }

            }

            Console.WriteLine("I bet this will take some time");

            Console.Write("256*256:");

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

            if (ans2 == 65536)

            {

              Console.ForegroundColor = ConsoleColor.Green;

              Console.WriteLine("WOW you are really very smart.");

            }

            else if (ans2 != 65536)

            {

              Console.ForegroundColor = ConsoleColor.Red;

              Console.WriteLine("Oh no you answered it wrong. Try again:");

              points = points - 1;

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

              if (ty2 != 65536)

              {

                Console.ForegroundColor = ConsoleColor.Red;

                Console.WriteLine("Oops you answered the question wrong again, you are out.");

              }

              else if (ty2 == 65536)

              {

                Console.ForegroundColor = ConsoleColor.Green;

                Console.WriteLine("YAY you answered the question right.");

              }

            }

          }

          Console.ForegroundColor = ConsoleColor.Cyan;

          Console.WriteLine("YAY, you attemped all the problems and your total points were:" + points + "/3.");

          Console.ReadLine();

        }    

      }

    }

  • ArkadeepArkadeep Member

    //Hi Brackeys. I have added a simple grading system using Switch-Case. Here is the code-

    using System;


    namespace Awesome_Projects

    {

        class Program

        {

            static void Main(string[] args)

            {

                Console.Title = "FRIDAY";

                int score = 0;


                // QUESTION 1

                Console.WriteLine("Welcome to the MATH QUIZ. \nHere is your First problem");

                Console.Write("10+20 = ");

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

                if(result1 == 30){

                    Console.ForegroundColor = ConsoleColor.Green;

                    Console.WriteLine("Correct");

                    score++;

                }else{

                    Console.ForegroundColor = ConsoleColor.Red;

                    Console.WriteLine("Wrong");

                }


                // QUESTION 2

                Console.ForegroundColor = ConsoleColor.White;

                Console.WriteLine("Here is your Second problem");

                Console.Write("999*999 = ");

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

                if(result2 == 998001){

                    Console.ForegroundColor = ConsoleColor.Green;

                    Console.WriteLine("Correct");

                    score++;

                }else{

                    Console.ForegroundColor = ConsoleColor.Red;

                    Console.WriteLine("Wrong");

                }

                

                // QUESTION 3

                Console.ForegroundColor = ConsoleColor.White;

                Console.WriteLine("Here is your Third problem");

                Console.Write("(4+3+2+1)/2 = ");

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

                if(result3 == 5){

                    Console.ForegroundColor = ConsoleColor.Green;

                    Console.WriteLine("Correct");

                    score++;

                }else{

                    Console.ForegroundColor = ConsoleColor.Red;

                    Console.WriteLine("Wrong");

                }


                // QUESTION 4

                Console.ForegroundColor = ConsoleColor.White;

                Console.WriteLine("Here is your Fourh problem");

                Console.Write("2/2 = ");

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

                if(result4 == 1){

                    Console.ForegroundColor = ConsoleColor.Green;

                    Console.WriteLine("Correct");

                    score++;

                }else{

                    Console.ForegroundColor = ConsoleColor.Red;

                    Console.WriteLine("Wrong");

                }


                // QUESTION 5

                Console.ForegroundColor = ConsoleColor.White;

                Console.WriteLine("Here is your Fifth problem");

                Console.Write("128*789*548*0*896*999 = ");

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

                if(result5 == 0){

                    Console.ForegroundColor = ConsoleColor.Green;

                    Console.WriteLine("Correct");

                    score++;

                }else{

                    Console.ForegroundColor = ConsoleColor.Red;

                    Console.WriteLine("Wrong");

                }


                //SCORE COUNT & GRADING

                Console.ForegroundColor = ConsoleColor.White;

                Console.WriteLine("Your final score is: " + score);

                Console.WriteLine("Your grade is");


                switch(score){

                    case 0:

                        Console.WriteLine("F");

                        break;

                    case 1:

                        Console.WriteLine("D");

                        break;

                    case 2:

                        Console.WriteLine("C");

                        break;

                    case 3:

                        Console.WriteLine("B");

                        break;

                    case 4:

                        Console.WriteLine("A");

                        break;

                    case 5:

                        Console.WriteLine("A+");

                        break;

                    default:

                        Console.WriteLine("Default");

                        break;              

                }

                Console.ReadKey();


            }

        }

    }

  • DexyelDexyel Member
    edited July 22

    Here's my solution :)

    using System;
    
    namespace _1
    {
        class Program
        {
            static void Main(string[] args)
            {
                //console settings
                Console.Title = "Brackeys Tutorials";
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WindowHeight = 40;
    
                //variables
                double calcA = 15 + 2 * 2;
                double calcB = 10 * 2 / 4;
                double calcC = (4 + 3 + 2 + 1) / 2;
    
                double resultA, resultB, resultC;
    
                //A
                Console.Write("15 + 2 * 2 = ");
                resultA = Convert.ToInt32(Console.ReadLine());
    
                if (resultA == calcA)
                {
                    Console.WriteLine("Correct");
                }
                else
                {
                    Console.WriteLine("Wrong");
                }
    
                //B
                Console.Write("10 * 2 / 4 = ");
                resultB = Convert.ToInt32(Console.ReadLine());
    
                if (resultB == calcB)
                {
                    Console.WriteLine("Correct");    
                }
                else
                {
                    Console.WriteLine("Wrong");
                }
    
                //C
                Console.Write("(4 + 3 + 2 + 1) / 2 = ");
                resultC = Convert.ToInt32(Console.ReadLine());
    
                if (resultC == calcC)
                {
                    Console.WriteLine("Correct");    
                }
                else
                {
                    Console.WriteLine("Wrong");
                }
                
                Console.ReadKey();        
            }
        }
    }
    
  • EylamEylam Member
    edited July 25

    Here's my solution :


    using System;


    namespace Episode_3_qus

    {

      class Program

      {

        static void Main(string[] args)

        {

          int correct = 0;

          int worng = 0;

          Console.WriteLine("Here's a question: 15 * 2 + 10 = ?");

          Console.WriteLine("You have 4 options:");

          Console.WriteLine("1. 40  2. 25");

          Console.WriteLine("3. 30  4. 50");

          Console.Write("Your choose is: ");

          int choose;

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

          if (choose == 1)

          {

            Console.WriteLine("Correct!");

            correct++;

          }

          else

          {

            Console.WriteLine("You worng!");

            worng++;

          }




          Console.WriteLine("Here's a question: 19 * 2 + 15 = ?");

          Console.WriteLine("You have 4 options:");

          Console.WriteLine("1. -6  2. 100");

          Console.WriteLine("3. 53  4. 77");

          Console.Write("Your choose is: ");

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

          if (choose == 3)

          {

            Console.WriteLine("Correct!");

            correct++;

          }

          else

          {

            Console.WriteLine("You worng!");

            worng++;

          }





          Console.WriteLine("Here's a question: 100 * 2 + 2 = ?");

          Console.WriteLine("You have 4 options:");

          Console.WriteLine("1. 203  2. 202");

          Console.WriteLine("3. 200  4. 254");

          Console.Write("Your choose is: ");

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

          if (choose == 2)

          {

            Console.WriteLine("Correct!");

            correct++;

          }

          else

          {

            Console.WriteLine("You worng!");

            worng++;

          }


          Console.WriteLine("\n");

          Console.WriteLine("You answered " + correct + " questions correctly");

          Console.WriteLine("You made a mistake in " + worng + " questions");

        }

      }

    }

  • S4mS4m Member

    Hi! If someone wanna execute this program. Do it and let me know how you like it.

  • using System;
    
    
    namespace Learning_C____Conditions
    {
        class Program
        {
            static void Main(string[] args)
            {
                double ans;
    
    
                Console.Write("23 + 9 = ");
                ans = Convert.ToDouble(Console.ReadLine());
                if(ans == 32) {
                    Console.WriteLine("Correct!");
                } else {
                    Console.WriteLine("Incorrect!");
                }
    
    
                Console.Write("75 / 15 = ");
                ans = Convert.ToDouble(Console.ReadLine());
                if(ans == 5) {
                    Console.WriteLine("Correct!");
                } else {
                    Console.WriteLine("Incorrect!");
                }
    
    
                Console.Write("7 * 7 = ");
                ans = Convert.ToDouble(Console.ReadLine());
                if(ans == 49) {
                    Console.WriteLine("Correct!");
                } else {
                    Console.WriteLine("Incorrect!");
                }
    
    
                Console.Write("93 - 17 = ");
                ans = Convert.ToDouble(Console.ReadLine());
                if(ans == 76) {
                    Console.WriteLine("Correct!");
                } else {
                    Console.WriteLine("Incorrect!");
                }
    
    
                Console.Write("47.3 + 24.8 = ");
                ans = Convert.ToDouble(Console.ReadLine());
                if(ans == 72.1) {
                    Console.WriteLine("Correct!");
                } else {
                    Console.WriteLine("Incorrect!");
                }
    
    
                Console.WriteLine("\nFarewell!");
    
    
                // Wait before closing
                Console.ReadKey();
            }
        }
    }
    
    
  • Hi here is my answer to your challenge :D


Sign In or Register to comment.