hey guys can u help me out finding the right why to solve this problem Finding a three-digit number or an additional close to it using 5 single-digit numbers, 1 two-digit (its multiples) and four operations . The closest number (/ -) may be 9 differences. All numbers will be generated randomly. It is not necessary to use all numbers for the number to be found . Ex: Finding the number 611 using the numbers 8, 6, 7, 7, 3, 60.8 3 = 1160 * 11 = 6607 * 7 = 49660-49 = 611
i tried to generate the random numbers so this what i came up with:
class Program
{
static void Main(string[] args)
{
int[] singleDigit = new int[6];
int twoDigit;
int threeDigit;
int answer = 0;
string op;
string op1 = "+";
string op2 = "-";
string op3 = "*";
string op4 = "/";
Random rand1 = new Random();
for(int i=0; i<6; i++)
{
singleDigit[i] = rand1.Next(0, 10);
Console.WriteLine(singleDigit[i]);
}
twoDigit = rand1.Next(9, 101);
Console.WriteLine(twoDigit);
threeDigit = rand1.Next(99, 1001);
Console.WriteLine(threeDigit);
var operator = { "+", "-", "*", "/"};
var operator = getRandomOperator();
while (answer != threeDigit)
{
}
Console.ReadLine();
}
}
Aucun commentaire:
Enregistrer un commentaire