#### 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

13»

• Member

I did it this way is it right?

using System;

namespace My_First___PRO___Program

{

class Program

{

static void Main(string[] args)

{

double num01;

double num02;

double num03;

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

if(num01 == 10 ) {

Console.WriteLine("Correct!");

} else {

Console.WriteLine("Wrong!");

}

Console.Write("6 / 3 + 8 = ");

if(num02 == 10 ) {

Console.WriteLine("Correct!");

} else {

Console.WriteLine("Wrong!");

}

Console.Write("3 - 2 * 1 = ");

if(num03 == 1 ) {

Console.WriteLine("Correct!");

} else {

Console.WriteLine("Wrong!");

}

}

}

}

• Member
• Member

KurRuppted (F5)

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

// problems

Console.Write("10+9*9: ");

{

Console.WriteLine("Correct!");

}

else

{

Console.WriteLine("Incorrect");

}

Console.Write("7+9*7-8: ");

{

Console.WriteLine("Correct");

}

else{

Console.WriteLine("Incorrect");

}

Console.Write("9*8-8/2+7: ");

{

Console.WriteLine("Correct");

}

else

{

Console.WriteLine("Incorrect");

}

// end

Console.WriteLine("You have finished the math problem quiz thing!");

}

}

}

• Member

using System;

namespace Quiz_Game_Math

{

class Program

{

static void Main(string[] args)

{

// First problem

Console.Write("15 + 2 * 2 = ");

Console.WriteLine("Correct!");

} else {

Console.WriteLine("Incorrect!");

}

// Second problem

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

Console.WriteLine("Correct!");

} else {

Console.WriteLine("Wrong!");

}

// Third problem

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

Console.WriteLine("Correct!");

} else {

Console.WriteLine("Wrong!");

Console.Write("4+2/3x7(12+33)/3");

{

Console.Write("Correct!");

}

else

{

Console.Write("Incorrect!");

}

Console.Write("\$5,876 are distributed equally among 26 men.);

Console.Write("How much money will each person get?);

{

Console.Write("Correct!");

}

else

{

Console.WriteLine("Incorrect!");

}

// Wait before closing

I'm adding more! We're making games, we'll post them here, so hang on with us!

• Member

using System;

namespace Quiz_Game_Math

{

class Program

{

static void Main(string[] args)

{

// First problem

Console.Write("15 + 2 * 2 = ");

Console.WriteLine("Correct!");

} else {

Console.WriteLine("Incorrect!");

}

// Second problem

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

Console.WriteLine("Correct!");

} else {

Console.WriteLine("Wrong!");

}

// Third problem

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

Console.WriteLine("Correct!");

} else {

Console.WriteLine("Wrong!");

Console.Write("4+2/3x7(12+33)/3");

{

Console.Write("Correct!");

}

else

{

Console.Write("Incorrect!");

}

Console.Write("\$5,876 are distributed equally among 26 men.);

Console.Write("How much money will each person get?);

{

Console.Write("Correct!");

}

else

{

Console.WriteLine("Incorrect!");

}

// Wait before closing

Hang around with us because we'll make a game!

• Member

Here is the code:

Here is if the user gets it corect:

Here is if the get it wrong:

Also thank you Brackeys for the tutorials I enjoy coding with you and the fun challenges.

• Member

`Console.Write("2 + 2 = ");`

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

`if (answer == 4){`

` Console.WriteLine("Correct!");`

`}else{Console.WriteLine("Wrong!");}`

`Console.Write("7 * 6 / 3 = ");`

`int answer2 = Convert.ToInt32(Console.ReadLine());`

`if (answer2 == 14){`

`Console.WriteLine("Correct!");`

`}else{Console.WriteLine("Wrong!");}`

`Console.Write("(4 + 5 * 6) + 2 = ");`

`int answer1 = Convert.ToInt32(Console.ReadLine());`

`if (answer1 == 36){`

` Console.WriteLine("Correct!");`

`}else{Console.WriteLine("Wrong!");}`

`Console.ReadKey();`

• Member

//first problem

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

{

Console.WriteLine("Correct!");

}

else

{

Console.WriteLine("Wrong!");

}

//second problem

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

{

Console.WriteLine("Correct!");

}

else

{

Console.WriteLine("Wrong!");

}

//third problem

Console.Write("8646678893 + 8899 / 9558 * 758679 + (-4784 * 67784) = ");

{

Console.WriteLine("Correct!");

}

else

{

Console.WriteLine("Wrong!");

}

//final problem

Console.Write("The sum of three numbers is 98.\nThe ratio of the first to the second is 2/3, \nand the ratio of the second to the third is 5/8. The second number is:");

{

Console.WriteLine("Correct!");

}

else

{

Console.WriteLine("Wrong!");

}

• Member

that was fun!

• Member
edited May 7

i did the challenge-03

using System;

namespace Maths_Quiz

{

internal class Program

{

static void Main(string[] args)

{

//Appearance

Console.Title = "Maths Quiz";

Console.BackgroundColor = ConsoleColor.DarkGreen;

Console.ForegroundColor = ConsoleColor.Black;

//variables

int ans1 = 11;

int ans2 = 24;

int ans3 = 46;

int ans4 = 44;

int ans5 = 6;

int ans6 = 12;

int ans7 = 14;

int ans8 = 12;

int ans9 = 48;

int ans10 = 126;

int userInput;

int correct = 0;

//Quiz Yes or no

Console.WriteLine("y if you want to do the maths quiz\nn if you don't want to do the maths quiz");

if (yn == "y"){

//Quiz

Console.Write("Great!\nLets start the quiz.\nThere are 10 maths questions for you to solve.\nHere it Starts!\nThe average of 10, 11 and 12 is ");

if (userInput == ans1){

Console.WriteLine("Correct!");

correct = correct + 1;

}

Console.Write("12 + 12 = ");

if (userInput == ans2){

Console.WriteLine("Correct!");

correct = correct + 1;

}else{

}

Console.Write("34 + 12 = ");

if (userInput == ans3){

Console.WriteLine("Correct!");

correct = correct + 1;

}else{

}

Console.Write("22 * 2 = ");

if (userInput == ans4){

Console.WriteLine("Correct!");

correct = correct + 1;

}else{

}

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

if (userInput == ans5){

Console.WriteLine("Correct!");

correct = correct + 1;

}else{

}

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

if (userInput == ans6){

Console.WriteLine("Correct!");

correct = correct + 1;

}else{

}

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

if (userInput == ans7){

Console.WriteLine("Correct!");

correct = correct + 1;

}else{

}

Console.Write("18 + 18 / 3 = ");

if (userInput == ans8){

Console.WriteLine("Correct!");

correct = correct + 1;

}else{

}

Console.Write("12 + 12 * 2 = ");

if (userInput == ans9){

Console.WriteLine("Correct!");

correct = correct + 1;

}else{

}

Console.Write("9 * 14 = ");

if (userInput == ans10){

Console.WriteLine("Correct!");

correct = correct + 1;

}else{

}

Console.WriteLine("You got " + correct + " out of 10 answers correct!");

}else if (yn == "n"){

//quiz end

Console.WriteLine("It's ok if you don't want to do the maths quiz.");

}

//wait before closing

}

}

}

• Member
edited May 14

• Member
edited May 14

I know It explodes every time your enter in a string value but eh