C
C#2y ago
ilycryst

❔ Ending the cmd if answer FOR Q1 is wrong, can't do it myself im new.

// Maths game for Addition :D + ++ +++ using System.Reflection.Metadata.Ecma335; using System.Security.Cryptography; internal class Program { private static void Main(string[] args) { int age; int A1; Console.WriteLine("Hello!"); Console.WriteLine("\n What is your age?"); age = Convert.ToInt32(Console.ReadLine()); if (age == 3) Console.WriteLine("\nLet's start"); if (age == 4) Console.WriteLine("\nLet's start"); if (age == 5) Console.WriteLine("\nLet's Start"); if (age == 6) Console.WriteLine("\nLet's Start"); if (age == 7) Console.WriteLine("\nLet's Start"); Console.WriteLine("\n89 + 72?"); A1 = Convert.ToInt32(Console.ReadLine()); if (A1 == 162) { Console.WriteLine("\nCorrect!"); } else if (A1 > 162) { Console.WriteLine("\nYou're wrong, rerun the program to try again!"); } else if (A1 < 162) { Console.WriteLine("\nYou're wrong, rerun the program to try again!"); } int A2; Console.WriteLine("\n65 + 72?"); A2 = Convert.ToInt32(Console.ReadLine()); if (A2 == 137) { Console.WriteLine("\nCorrect!"); } else if (A2 > 137) { Console.WriteLine("\nYou're wrong, rerun the program to try again"); } else if (A2 < 137) { Console.WriteLine("\nYou're wrong, rerun the program to try again"); } _ = Console.ReadKey();
} }
12 Replies
ilycryst
ilycryst2y ago
THE CODE
friedice
friedice2y ago
$code
MODiX
MODiX2y ago
To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat If your code is too long, post it to: https://paste.mod.gg/ To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat If your code is too long, post it to: https://paste.mod.gg/
ilycryst
ilycryst2y ago
$codegif
ilycryst
ilycryst2y ago
cs
// Maths game for Addition :D + ++ +++


using System.Reflection.Metadata.Ecma335;
using System.Security.Cryptography;

internal class Program
{
private static void Main(string[] args)
{
int age;
int A1;



Console.WriteLine("Hello!");
Console.WriteLine("\n What is your age?");

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


if (age == 3)

Console.WriteLine("\nLet's start");


if (age == 4)

Console.WriteLine("\nLet's start");
if (age == 5)
Console.WriteLine("\nLet's Start");
if (age == 6)
Console.WriteLine("\nLet's Start");
if (age == 7)
Console.WriteLine("\nLet's Start");


Console.WriteLine("\n89 + 72?");

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

if (A1 == 162)
{
Console.WriteLine("\nCorrect!");
}

else if (A1 > 162)
{
Console.WriteLine("\nYou're wrong, rerun the program to try again!");
}
else if (A1 < 162)
{
Console.WriteLine("\nYou're wrong, rerun the program to try again!");
}

int A2;

Console.WriteLine("\n65 + 72?");

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

if (A2 == 137)
{

Console.WriteLine("\nCorrect!");
}

else if (A2 > 137)
{

Console.WriteLine("\nYou're wrong, rerun the program to try again");
}

else if (A2 < 137)
{
Console.WriteLine("\nYou're wrong, rerun the program to try again");
}




_ = Console.ReadKey();




}
}
cs
// Maths game for Addition :D + ++ +++


using System.Reflection.Metadata.Ecma335;
using System.Security.Cryptography;

internal class Program
{
private static void Main(string[] args)
{
int age;
int A1;



Console.WriteLine("Hello!");
Console.WriteLine("\n What is your age?");

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


if (age == 3)

Console.WriteLine("\nLet's start");


if (age == 4)

Console.WriteLine("\nLet's start");
if (age == 5)
Console.WriteLine("\nLet's Start");
if (age == 6)
Console.WriteLine("\nLet's Start");
if (age == 7)
Console.WriteLine("\nLet's Start");


Console.WriteLine("\n89 + 72?");

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

if (A1 == 162)
{
Console.WriteLine("\nCorrect!");
}

else if (A1 > 162)
{
Console.WriteLine("\nYou're wrong, rerun the program to try again!");
}
else if (A1 < 162)
{
Console.WriteLine("\nYou're wrong, rerun the program to try again!");
}

int A2;

Console.WriteLine("\n65 + 72?");

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

if (A2 == 137)
{

Console.WriteLine("\nCorrect!");
}

else if (A2 > 137)
{

Console.WriteLine("\nYou're wrong, rerun the program to try again");
}

else if (A2 < 137)
{
Console.WriteLine("\nYou're wrong, rerun the program to try again");
}




_ = Console.ReadKey();




}
}
$code
MODiX
MODiX2y ago
To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat If your code is too long, post it to: https://paste.mod.gg/
ilycryst
ilycryst2y ago
HELLO THERE
HELLO THERE
GENERAL KENOBI
GENERAL KENOBI
Angius
Angius2y ago
$codegif
Angius
Angius2y ago
cs on the same line as ``` And since you have everything inside of Main(), you can just return; to end the application
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.