Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Order of Ops 5 (easier)
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using ShuffleExtension; using System.Threading; using System.Data; using MathSpace; using CountExtension; namespace Rextester { public class Program { public static void Main(string[] args) { makeOpQ(); } public static void makeOpQ() { string fmt = "##;(-##)"; string[] op = new string[] {"+", "-", "*", "/"}; int numQ = 256; List<string>[] opQ = new List<string>[numQ]; for (int i = 0; i < numQ; i++){ opQ[i] = new List<string>(); } int result, count; decimal resultD; List<string> questions = new List<string>(); int countQ = 0; while(questions.Count()<200) { int[] n = new int[5]; HashSet<int> numbers = new HashSet<int>(); while (numbers.Count < 5) { numbers.Add(Rand.NextPM(2,99)); // can change to Rand.Next(2,99) for positive integers or Rand.NextPM(2,99) for all integers } numbers.CopyTo(n); int a = Rand.Next(0,4); int b = Rand.Next(0,4); int c = Rand.Next(0,4); int d = Rand.Next(0,4); // 1st switch switch(op[a]) { case "+": // 2nd switch + switch(op[b]) { case "+": // 3rd switch ++ switch(op[c]) { case "+": // 4th switch +++ switch(op[d]) { case "+": result = n[0] + n[1] + n[2] + n[3] + n[4]; if (opQ[0].Count()<1 && Math.Abs(result)<100 ) { opQ[0].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] + n[1] + n[2] + n[3] - n[4]; if (opQ[1].Count()<1 && Math.Abs(result)<100 ) { opQ[1].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] + n[1] + n[2] + n[3] * n[4]; if (opQ[2].Count()<1 && Math.Abs(result)<100 ) { opQ[2].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] + n[1] + n[2] + ((decimal)n[3] /(decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[3].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[3].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break +++ case "-": // 4th switch ++- switch(op[d]) { case "+": result = n[0] + n[1] + n[2] - n[3] + n[4]; if (opQ[4].Count()<1 && Math.Abs(result)<100 ) { opQ[4].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] + n[1] + n[2] - n[3] - n[4]; if (opQ[5].Count()<1 && Math.Abs(result)<100 ) { opQ[5].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] + n[1] + n[2] - n[3] * n[4]; if (opQ[6].Count()<1 && Math.Abs(result)<100 ) { opQ[6].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] + n[1] + n[2] - ((decimal) n[3] / (decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[7].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[7].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break ++- case "*": // 4th switch ++* switch(op[d]) { case "+": result = n[0] + n[1] + n[2] * n[3] + n[4]; if (opQ[8].Count()<1 && Math.Abs(result)<100 ) { opQ[8].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] + n[1] + n[2] * n[3] - n[4]; if (opQ[9].Count()<1 && Math.Abs(result)<100 ) { opQ[9].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] + n[1] + n[2] * n[3] * n[4]; if (opQ[10].Count()<1 && Math.Abs(result)<100 ) { opQ[10].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] + n[1] + ((decimal) n[2] * n[3] / (decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[11].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[11].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break ++* case "/": // 4th switch ++/ switch(op[d]) { case "+": resultD = n[0] + n[1] + ((decimal)n[2] /(decimal)n[3]) + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[12].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[12].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = n[0] + n[1] + ((decimal)n[2] /(decimal)n[3]) - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[13].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[13].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = n[0] + n[1] + ((decimal)n[2] /(decimal)n[3]) * n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[14].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[14].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = n[0] + n[1] + ((decimal) n[2] / (decimal)n[3] /(decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[15].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[15].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break ++/ } break; // 2nd switch break ++ case "-": //3rd switch +- switch(op[c]) { case "+": // 4th switch +-+ switch(op[d]) { case "+": result = n[0] + n[1] - n[2] + n[3] + n[4]; if (opQ[16].Count()<1 && Math.Abs(result)<100 ) { opQ[16].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] + n[1] - n[2] + n[3] - n[4]; if (opQ[17].Count()<1 && Math.Abs(result)<100 ) { opQ[17].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] + n[1] - n[2] + n[3] * n[4]; if (opQ[18].Count()<1 && Math.Abs(result)<100 ) { opQ[18].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] + n[1] - n[2] + ((decimal)n[3] / (decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[19].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[19].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break +-+ case "-": // 4th switch +-- switch(op[d]) { case "+": result = n[0] + n[1] - n[2] - n[3] + n[4]; if (opQ[20].Count()<1 && Math.Abs(result)<100 ) { opQ[20].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] + n[1] - n[2] - n[3] - n[4]; if (opQ[21].Count()<1 && Math.Abs(result)<100 ) { opQ[21].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] + n[1] - n[2] - n[3] * n[4]; if (opQ[22].Count()<1 && Math.Abs(result)<100 ) { opQ[22].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] + n[1] - n[2] - ((decimal)n[3] / (decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[23].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[23].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break +-- case "*": // 4th switch +-* switch(op[d]) { case "+": result = n[0] + n[1] - n[2] * n[3] + n[4]; if (opQ[24].Count()<1 && Math.Abs(result)<100 ) { opQ[24].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] + n[1] - n[2] * n[3] - n[4]; if (opQ[25].Count()<1 && Math.Abs(result)<100 ) { opQ[25].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] + n[1] - n[2] * n[3] * n[4]; if (opQ[26].Count()<1 && Math.Abs(result)<100 ) { opQ[26].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] + n[1] - ((decimal) (n[2] * n[3]) / (decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[27].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[27].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break +-* case "/": // 4th switch +-/ switch(op[d]) { case "+": resultD = n[0] + n[1] - ( (decimal)n[2] / (decimal)n[3]) + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[28].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[28].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = n[0] + n[1] - ((decimal) n[2] /(decimal) n[3]) - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[29].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[29].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = n[0] + n[1] - ((decimal) n[2] /(decimal) n[3] * n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[30].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[30].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = n[0] + n[1] - ((decimal)n[2] / (decimal)n[3]) / (decimal)n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[31].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[31].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break +-/ } break; // 2nd switch break +- case "*": //3rd switch +* switch(op[c]) { case "+": // 4th switch +*+ switch(op[d]) { case "+": result = n[0] + n[1] * n[2] + n[3] + n[4]; if (opQ[32].Count()<1 && Math.Abs(result)<100 ) { opQ[32].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] + n[1] * n[2] + n[3] - n[4]; if (opQ[33].Count()<1 && Math.Abs(result)<100 ) { opQ[33].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] + n[1] * n[2] + n[3] * n[4]; if (opQ[34].Count()<1 && Math.Abs(result)<100 ) { opQ[34].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] + n[1] * n[2] + ((decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[35].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[35].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break +*+ case "-": // 4th switch +*- switch(op[d]) { case "+": result = n[0] + n[1] * n[2] - n[3] + n[4]; if (opQ[36].Count()<1 && Math.Abs(result)<100 ) { opQ[36].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] + n[1] * n[2] - n[3] - n[4]; if (opQ[37].Count()<1 && Math.Abs(result)<100 ) { opQ[37].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] + n[1] * n[2] - n[3] * n[4]; if (opQ[38].Count()<1 && Math.Abs(result)<100 ) { opQ[38].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] + n[1] * n[2] - ((decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[39].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[39].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break +*- case "*": // 4th switch +** switch(op[d]) { case "+": result = n[0] + n[1] * n[2] * n[3] + n[4]; if (opQ[40].Count()<1 && Math.Abs(result)<100 ) { opQ[40].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] + n[1] * n[2] * n[3] - n[4]; if (opQ[41].Count()<1 && Math.Abs(result)<100 ) { opQ[41].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] + n[1] * n[2] * n[3] * n[4]; if (opQ[42].Count()<1 && Math.Abs(result)<100 ) { opQ[42].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] + ((decimal) n[1] * n[2] * n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[43].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[43].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break +** case "/": // 4th switch +*/ switch(op[d]) { case "+": resultD = n[0] + ((decimal) n[1] * n[2] / (decimal) n[3]) + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[44].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[44].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = n[0] + ((decimal) n[1] * n[2] / (decimal) n[3]) - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[45].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[45].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = n[0] + (decimal) n[1] * (decimal) n[2] / (decimal) n[3] * (decimal) n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[46].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[46].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = n[0] + ((decimal) (n[1] * n[2]) / (decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[47].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[47].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break +*/ } break; // 2nd switch break +* case "/": //3rd switch +/ switch(op[c]) { case "+": // 4th switch +/+ switch(op[d]) { case "+": resultD = n[0] + ((decimal) n[1] / (decimal) n[2]) + n[3] + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[48].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[48].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = n[0] + ((decimal) n[1] / (decimal) n[2]) + n[3] - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[49].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[49].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = n[0] + ((decimal) n[1] / (decimal) n[2]) + n[3] * n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[50].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[50].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = n[0] + ((decimal) n[1] / (decimal) n[2]) + ((decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[51].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[51].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break +/+ case "-": // 4th switch +/- switch(op[d]) { case "+": resultD = n[0] + ((decimal) n[1] / (decimal) n[2]) - n[3] + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[52].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[52].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = n[0] + ((decimal) n[1] / (decimal) n[2]) - n[3] - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[53].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[53].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = n[0] + ((decimal) n[1] / (decimal) n[2]) - n[3] * n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[54].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[54].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = n[0] + ((decimal) n[1] / (decimal) n[2]) - ((decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[55].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[55].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break +/- case "*": // 4th switch +/* switch(op[d]) { case "+": resultD = n[0] + ((decimal) n[1] / (decimal) n[2] * n[3]) + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[56].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[56].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = n[0] + ((decimal) n[1] / (decimal) n[2] * n[3]) - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[57].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[57].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = n[0] + ((decimal) n[1] / (decimal) n[2] * n[3] * n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[58].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[58].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = n[0] + ((decimal) n[1] / (decimal) n[2] * (decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[59].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[59].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break +/* case "/": // 4th switch +// switch(op[d]) { case "+": resultD = n[0] + ((decimal) n[1] / (decimal) n[2] / (decimal) n[3]) + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[60].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[60].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = n[0] + ((decimal) n[1] / (decimal) n[2] / (decimal) n[3]) - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[61].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[61].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = n[0] + ((decimal) n[1] / (decimal) n[2] / (decimal) n[3] * n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[62].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[62].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = n[0] + ((decimal) n[1] / (decimal) n[2] / (decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[63].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[63].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" + "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break +// } break; // 2nd switch break +/ } break; // 1st switch break + case "-": // 2nd switch - switch(op[b]) { case "+": // 3rd switch -+ switch(op[c]) { case "+": // 4th switch -++ switch(op[d]) { case "+": result = n[0] - n[1] + n[2] + n[3] + n[4]; if (opQ[64].Count()<1 && Math.Abs(result)<100 ) { opQ[64].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] - n[1] + n[2] + n[3] - n[4]; if (opQ[65].Count()<1 && Math.Abs(result)<100 ) { opQ[65].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] - n[1] + n[2] + n[3] * n[4]; if (opQ[66].Count()<1 && Math.Abs(result)<100 ) { opQ[66].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] - n[1] + n[2] + ((decimal)n[3] /(decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[67].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[67].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break -++ case "-": // 4th switch -+- switch(op[d]) { case "+": result = n[0] - n[1] + n[2] - n[3] + n[4]; if (opQ[68].Count()<1 && Math.Abs(result)<100 ) { opQ[68].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] - n[1] + n[2] - n[3] - n[4]; if (opQ[69].Count()<1 && Math.Abs(result)<100 ) { opQ[69].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] - n[1] + n[2] - n[3] * n[4]; if (opQ[70].Count()<1 && Math.Abs(result)<100 ) { opQ[70].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] - n[1] + n[2] - ((decimal) n[3] / (decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[71].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[71].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break -+- case "*": // 4th switch -+* switch(op[d]) { case "+": result = n[0] - n[1] + n[2] * n[3] + n[4]; if (opQ[72].Count()<1 && Math.Abs(result)<100 ) { opQ[72].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] - n[1] + n[2] * n[3] - n[4]; if (opQ[73].Count()<1 && Math.Abs(result)<100 ) { opQ[73].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] - n[1] + n[2] * n[3] * n[4]; if (opQ[74].Count()<1 && Math.Abs(result)<100 ) { opQ[74].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] - n[1] + ((decimal) n[2] * n[3] / (decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[75].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[75].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break -+* case "/": // 4th switch -+/ switch(op[d]) { case "+": resultD = n[0] - n[1] + ((decimal)n[2] /(decimal)n[3]) + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[76].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[76].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = n[0] - n[1] + ((decimal)n[2] /(decimal)n[3]) - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[77].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[77].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = n[0] - n[1] + ((decimal)n[2] /(decimal)n[3]) * n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[78].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[78].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = n[0] - n[1] + ((decimal) n[2] / (decimal)n[3] /(decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[79].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[79].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break -+/ } break; // 2nd switch break -+ case "-": //3rd switch -- switch(op[c]) { case "+": // 4th switch --+ switch(op[d]) { case "+": result = n[0] - n[1] - n[2] + n[3] + n[4]; if (opQ[80].Count()<1 && Math.Abs(result)<100 ) { opQ[80].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] - n[1] - n[2] + n[3] - n[4]; if (opQ[81].Count()<1 && Math.Abs(result)<100 ) { opQ[81].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] - n[1] - n[2] + n[3] * n[4]; if (opQ[82].Count()<1 && Math.Abs(result)<100 ) { opQ[82].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] - n[1] - n[2] + ((decimal)n[3] / (decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[83].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[83].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break --+ case "-": // 4th switch --- switch(op[d]) { case "+": result = n[0] - n[1] - n[2] - n[3] + n[4]; if (opQ[84].Count()<1 && Math.Abs(result)<100 ) { opQ[84].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] - n[1] - n[2] - n[3] - n[4]; if (opQ[85].Count()<1 && Math.Abs(result)<100 ) { opQ[85].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] - n[1] - n[2] - n[3] * n[4]; if (opQ[86].Count()<1 && Math.Abs(result)<100 ) { opQ[86].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] - n[1] - n[2] - ((decimal)n[3] / (decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[87].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[87].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break --- case "*": // 4th switch --* switch(op[d]) { case "+": result = n[0] - n[1] - n[2] * n[3] + n[4]; if (opQ[88].Count()<1 && Math.Abs(result)<100 ) { opQ[88].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] - n[1] - n[2] * n[3] - n[4]; if (opQ[89].Count()<1 && Math.Abs(result)<100 ) { opQ[89].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] - n[1] - n[2] * n[3] * n[4]; if (opQ[90].Count()<1 && Math.Abs(result)<100 ) { opQ[90].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] - n[1] - ((decimal) (n[2] * n[3]) / (decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[91].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[91].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break --* case "/": // 4th switch --/ switch(op[d]) { case "+": resultD = n[0] - n[1] - ( (decimal)n[2] / (decimal)n[3]) + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[92].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[92].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = n[0] - n[1] - ((decimal) n[2] /(decimal) n[3]) - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[93].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[93].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = n[0] - n[1] - ((decimal) n[2] /(decimal) n[3] * n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[94].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[94].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = n[0] - n[1] - (decimal)n[2] / (decimal)n[3] / (decimal)n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[95].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[95].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break --/ } break; // 2nd switch break -- case "*": //3rd switch -* switch(op[c]) { case "+": // 4th switch -*+ switch(op[d]) { case "+": result = n[0] - n[1] * n[2] + n[3] + n[4]; if (opQ[96].Count()<1 && Math.Abs(result)<100 ) { opQ[96].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] - n[1] * n[2] + n[3] - n[4]; if (opQ[97].Count()<1 && Math.Abs(result)<100 ) { opQ[97].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] - n[1] * n[2] + n[3] * n[4]; if (opQ[98].Count()<1 && Math.Abs(result)<100 ) { opQ[98].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] - n[1] * n[2] + ((decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[99].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[99].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break -*+ case "-": // 4th switch -*- switch(op[d]) { case "+": result = n[0] - n[1] * n[2] - n[3] + n[4]; if (opQ[100].Count()<1 && Math.Abs(result)<100 ) { opQ[100].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] - n[1] * n[2] - n[3] - n[4]; if (opQ[101].Count()<1 && Math.Abs(result)<100 ) { opQ[101].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] - n[1] * n[2] - n[3] * n[4]; if (opQ[102].Count()<1 && Math.Abs(result)<100 ) { opQ[102].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] - n[1] * n[2] - ((decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[103].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[103].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break -*- case "*": // 4th switch -** switch(op[d]) { case "+": result = n[0] - n[1] * n[2] * n[3] + n[4]; if (opQ[104].Count()<1 && Math.Abs(result)<100 ) { opQ[104].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] - n[1] * n[2] * n[3] - n[4]; if (opQ[105].Count()<1 && Math.Abs(result)<100 ) { opQ[105].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] - n[1] * n[2] * n[3] * n[4]; if (opQ[106].Count()<1 && Math.Abs(result)<100 ) { opQ[106].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] - ((decimal) n[1] * n[2] * n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[107].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[107].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break -** case "/": // 4th switch -*/ switch(op[d]) { case "+": resultD = n[0] - ((decimal) n[1] * n[2] / (decimal) n[3]) + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[108].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[108].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = n[0] - ((decimal) n[1] * n[2] / (decimal) n[3]) - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[109].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[109].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = n[0] - (decimal) n[1] * (decimal) n[2] / (decimal) n[3] * (decimal) n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[110].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[110].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = n[0] - ((decimal) (n[1] * n[2]) / (decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[111].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[111].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break -*/ } break; // 2nd switch break -* case "/": //3rd switch -/ switch(op[c]) { case "+": // 4th switch -/+ switch(op[d]) { case "+": resultD = n[0] - ((decimal) n[1] / (decimal) n[2]) + n[3] + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[112].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[112].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = n[0] - ((decimal) n[1] / (decimal) n[2]) + n[3] - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[113].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[113].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = n[0] - ((decimal) n[1] / (decimal) n[2]) + n[3] * n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[114].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[114].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = n[0] - ((decimal) n[1] / (decimal) n[2]) + ((decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[115].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[115].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break -/+ case "-": // 4th switch -/- switch(op[d]) { case "+": resultD = n[0] - ((decimal) n[1] / (decimal) n[2]) - n[3] + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[116].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[116].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = n[0] - ((decimal) n[1] / (decimal) n[2]) - n[3] - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[117].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[117].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = n[0] - ((decimal) n[1] / (decimal) n[2]) - n[3] * n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[118].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[118].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = n[0] - ((decimal) n[1] / (decimal) n[2]) - ((decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[119].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[119].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break -/- case "*": // 4th switch -/* switch(op[d]) { case "+": resultD = n[0] - ((decimal) n[1] / (decimal) n[2] * n[3]) + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[120].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[120].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = n[0] - ((decimal) n[1] / (decimal) n[2] * n[3]) - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[121].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[121].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = n[0] - ((decimal) n[1] / (decimal) n[2] * n[3] * n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[122].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[122].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = n[0] - ((decimal) n[1] / (decimal) n[2] * (decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[123].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[123].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break -/* case "/": // 4th switch -// switch(op[d]) { case "+": resultD = n[0] - ((decimal) n[1] / (decimal) n[2] / (decimal) n[3]) + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[124].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[124].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = n[0] - ((decimal) n[1] / (decimal) n[2] / (decimal) n[3]) - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[125].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[125].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = n[0] - ((decimal) n[1] / (decimal) n[2] / (decimal) n[3] * n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[126].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[126].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = n[0] - ((decimal) n[1] / (decimal) n[2] / (decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[127].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[127].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" - "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break -// } break; // 2nd switch break -/ } break; // first switch break - case "*": // 2nd switch * switch(op[b]) { case "+": // 3rd switch *+ switch(op[c]) { case "+": // 4th switch *++ switch(op[d]) { case "+": result = n[0] * n[1] + n[2] + n[3] + n[4]; if (opQ[128].Count()<1 && Math.Abs(result)<100 ) { opQ[128].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] * n[1] + n[2] + n[3] - n[4]; if (opQ[129].Count()<1 && Math.Abs(result)<100 ) { opQ[129].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] * n[1] + n[2] + n[3] * n[4]; if (opQ[130].Count()<1 && Math.Abs(result)<100 ) { opQ[130].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] * n[1] + n[2] + ((decimal)n[3] /(decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[131].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[131].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break *++ case "-": // 4th switch *+- switch(op[d]) { case "+": result = n[0] * n[1] + n[2] - n[3] + n[4]; if (opQ[132].Count()<1 && Math.Abs(result)<100 ) { opQ[132].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] * n[1] + n[2] - n[3] - n[4]; if (opQ[133].Count()<1 && Math.Abs(result)<100 ) { opQ[133].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] * n[1] + n[2] - n[3] * n[4]; if (opQ[134].Count()<1 && Math.Abs(result)<100 ) { opQ[134].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] * n[1] + n[2] - ((decimal) n[3] / (decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[135].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[135].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break *+- case "*": // 4th switch *+* switch(op[d]) { case "+": result = n[0] * n[1] + n[2] * n[3] + n[4]; if (opQ[136].Count()<1 && Math.Abs(result)<100 ) { opQ[136].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] * n[1] + n[2] * n[3] - n[4]; if (opQ[137].Count()<1 && Math.Abs(result)<100 ) { opQ[137].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] * n[1] + n[2] * n[3] * n[4]; if (opQ[138].Count()<1 && Math.Abs(result)<100 ) { opQ[138].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] * n[1] + ((decimal) n[2] * n[3] / (decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[139].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[139].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break *+* case "/": // 4th switch *+/ switch(op[d]) { case "+": resultD = n[0] * n[1] + ((decimal)n[2] /(decimal)n[3]) + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[140].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[140].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = n[0] * n[1] + ((decimal)n[2] /(decimal)n[3]) - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[141].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[141].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = n[0] * n[1] + ((decimal)n[2] /(decimal)n[3]) * n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[142].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[142].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = n[0] * n[1] + ((decimal) n[2] / (decimal)n[3] /(decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[143].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[143].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break *+/ } break; // 2nd switch break *+ case "-": //3rd switch *- switch(op[c]) { case "+": // 4th switch *-+ switch(op[d]) { case "+": result = n[0] * n[1] - n[2] + n[3] + n[4]; if (opQ[144].Count()<1 && Math.Abs(result)<100 ) { opQ[144].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] * n[1] - n[2] + n[3] - n[4]; if (opQ[145].Count()<1 && Math.Abs(result)<100 ) { opQ[145].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] * n[1] - n[2] + n[3] * n[4]; if (opQ[146].Count()<1 && Math.Abs(result)<100 ) { opQ[146].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] * n[1] - n[2] + ((decimal)n[3] / (decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[147].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[147].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break *-+ case "-": // 4th switch *-- switch(op[d]) { case "+": result = n[0] * n[1] - n[2] - n[3] + n[4]; if (opQ[148].Count()<1 && Math.Abs(result)<100 ) { opQ[148].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] * n[1] - n[2] - n[3] - n[4]; if (opQ[149].Count()<1 && Math.Abs(result)<100 ) { opQ[149].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] * n[1] - n[2] - n[3] * n[4]; if (opQ[150].Count()<1 && Math.Abs(result)<100 ) { opQ[150].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] * n[1] - n[2] - ((decimal)n[3] / (decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[151].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[151].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break *-- case "*": // 4th switch *-* switch(op[d]) { case "+": result = n[0] * n[1] - n[2] * n[3] + n[4]; if (opQ[152].Count()<1 && Math.Abs(result)<100 ) { opQ[152].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] * n[1] - n[2] * n[3] - n[4]; if (opQ[153].Count()<1 && Math.Abs(result)<100 ) { opQ[153].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] * n[1] - n[2] * n[3] * n[4]; if (opQ[154].Count()<1 && Math.Abs(result)<100 ) { opQ[154].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] * n[1] - ((decimal) (n[2] * n[3]) / (decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[155].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[155].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break *-* case "/": // 4th switch *-/ switch(op[d]) { case "+": resultD = n[0] * n[1] - ( (decimal)n[2] / (decimal)n[3]) + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[156].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[156].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = n[0] * n[1] - ((decimal) n[2] /(decimal) n[3]) - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[157].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[157].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = n[0] * n[1] - ((decimal) n[2] /(decimal) n[3] * n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[158].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[158].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = n[0] * n[1] - ((decimal) n[2] / (decimal) n[3]) / (decimal) n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[159].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[159].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break *-/ } break; // 2nd switch break *- case "*": //3rd switch ** switch(op[c]) { case "+": // 4th switch **+ switch(op[d]) { case "+": result = n[0] * n[1] * n[2] + n[3] + n[4]; if (opQ[160].Count()<1 && Math.Abs(result)<100 ) { opQ[160].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] * n[1] * n[2] + n[3] - n[4]; if (opQ[161].Count()<1 && Math.Abs(result)<100 ) { opQ[161].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] * n[1] * n[2] + n[3] * n[4]; if (opQ[162].Count()<1 && Math.Abs(result)<100 ) { opQ[162].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] * n[1] * n[2] + ((decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[163].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[163].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break **+ case "-": // 4th switch **- switch(op[d]) { case "+": result = n[0] * n[1] * n[2] - n[3] + n[4]; if (opQ[164].Count()<1 && Math.Abs(result)<100 ) { opQ[164].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] * n[1] * n[2] - n[3] - n[4]; if (opQ[165].Count()<1 && Math.Abs(result)<100 ) { opQ[165].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] * n[1] * n[2] - n[3] * n[4]; if (opQ[166].Count()<1 && Math.Abs(result)<100 ) { opQ[166].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = n[0] * n[1] * n[2] - ((decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[167].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[167].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break **- case "*": // 4th switch *** switch(op[d]) { case "+": result = n[0] * n[1] * n[2] * n[3] + n[4]; if (opQ[168].Count()<1 && Math.Abs(result)<100 ) { opQ[168].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "-": result = n[0] * n[1] * n[2] * n[3] - n[4]; if (opQ[169].Count()<1 && Math.Abs(result)<100 ) { opQ[169].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "*": result = n[0] * n[1] * n[2] * n[3] * n[4]; if (opQ[170].Count()<1 && Math.Abs(result)<100 ) { opQ[170].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+result+"\\)"); } break; case "/": resultD = ((decimal) (n[0] * n[1] * n[2] * n[3]) / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[171].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[171].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break *** case "/": // 4th switch **/ switch(op[d]) { case "+": resultD = ((decimal) (n[0] * n[1] * n[2]) / (decimal) n[3]) + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[172].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[172].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = ((decimal) (n[0] * n[1] * n[2]) / (decimal) n[3]) - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[173].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[173].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = (decimal) (n[0] * n[1] * n[2]) / (decimal) n[3] * (decimal) n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[174].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[174].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = ((decimal) (n[0] * n[1] * n[2]) / (decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[175].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[175].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break **/ } break; // 2nd switch break ** case "/": //3rd switch */ switch(op[c]) { case "+": // 4th switch */+ switch(op[d]) { case "+": resultD = ((decimal) (n[0] * n[1]) / (decimal) n[2]) + n[3] + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[176].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[176].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = ((decimal) (n[0] * n[1]) / (decimal) n[2]) + n[3] - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[177].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[177].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = ((decimal) (n[0] * n[1]) / (decimal) n[2]) + n[3] * n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[178].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[178].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = ((decimal) (n[0] * n[1]) / (decimal) n[2]) + ((decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[179].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[179].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break */+ case "-": // 4th switch */- switch(op[d]) { case "+": resultD = ((decimal) (n[0] * n[1]) / (decimal) n[2]) - n[3] + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[180].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[180].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = ((decimal) (n[0] * n[1]) / (decimal) n[2]) - n[3] - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[181].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[181].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = ((decimal) (n[0] * n[1]) / (decimal) n[2]) - n[3] * n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[182].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[182].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = ((decimal) (n[0] * n[1]) / (decimal) n[2]) - ((decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[183].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[183].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break */- case "*": // 4th switch */* switch(op[d]) { case "+": resultD = ((decimal) (n[0] * n[1]) / (decimal) n[2] * n[3]) + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[184].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[184].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = ((decimal) (n[0] * n[1]) / (decimal) n[2] * n[3]) - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[185].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[185].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = ((decimal) (n[0] * n[1]) / (decimal) n[2] * n[3] * n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[186].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[186].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = ((decimal) (n[0] * n[1]) / (decimal) n[2] * (decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[187].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[187].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break */* case "/": // 4th switch *// switch(op[d]) { case "+": resultD = ((decimal) (n[0] * n[1]) / (decimal) n[2] / (decimal) n[3]) + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[188].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[188].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = ((decimal) (n[0] * n[1]) / (decimal) n[2] / (decimal) n[3]) - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[189].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[189].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = ((decimal) (n[0] * n[1]) / (decimal) n[2] / (decimal) n[3] * n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[190].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[190].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = ((decimal) (n[0] * n[1]) / (decimal) n[2] / (decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[191].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[191].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\times "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break *// } break; // 2nd switch break */ } break; // 1st switch break * case "/": // 2nd switch / switch(op[b]) { case "+": // 3rd switch /+ switch(op[c]) { case "+": // 4th switch /++ switch(op[d]) { case "+": resultD = ((decimal) n[0] / (decimal) n[1]) + n[2] + n[3] + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[192].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[192].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = ((decimal) n[0] / (decimal) n[1]) + n[2] + n[3] - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[193].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[193].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = ((decimal) n[0] / (decimal) n[1]) + n[2] + n[3] * n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[194].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[194].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = ((decimal) n[0] / (decimal) n[1]) + n[2] + ((decimal)n[3] /(decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[195].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[195].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break /++ case "-": // 4th switch /+- switch(op[d]) { case "+": resultD = ((decimal) n[0] / (decimal) n[1]) + n[2] - n[3] + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[196].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[196].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = ((decimal) n[0] / (decimal) n[1]) + n[2] - n[3] - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[197].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[197].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = ((decimal) n[0] / (decimal) n[1]) + n[2] - n[3] * n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[198].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[198].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = ((decimal) n[0] / (decimal) n[1]) + n[2] - ((decimal) n[3] / (decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[199].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[199].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break /+- case "*": // 4th switch /+* switch(op[d]) { case "+": resultD = ((decimal) n[0] / (decimal) n[1]) + n[2] * n[3] + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[200].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[200].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = ((decimal) n[0] / (decimal) n[1]) + n[2] * n[3] - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[201].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[201].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = ((decimal) n[0] / (decimal) n[1]) + n[2] * n[3] * n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[202].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[202].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = ((decimal) n[0] / (decimal) n[1]) + ((decimal) n[2] * n[3] / (decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[203].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[203].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break /+* case "/": // 4th switch /+/ switch(op[d]) { case "+": resultD = ((decimal) n[0] / (decimal) n[1]) + ((decimal)n[2] /(decimal)n[3]) + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[204].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[204].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = ((decimal) n[0] / (decimal) n[1]) + ((decimal)n[2] /(decimal)n[3]) - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[205].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[205].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = ((decimal) n[0] / (decimal) n[1]) + ((decimal)n[2] /(decimal)n[3]) * n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[206].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[206].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = ((decimal) n[0] / (decimal) n[1]) + ((decimal) n[2] / (decimal)n[3] /(decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[207].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[207].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" + "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break /+/ } break; // 2nd switch break /+ case "-": //3rd switch /- switch(op[c]) { case "+": // 4th switch /-+ switch(op[d]) { case "+": resultD = ((decimal) n[0] / (decimal) n[1]) - n[2] + n[3] + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[208].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[208].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = ((decimal) n[0] / (decimal) n[1]) - n[2] + n[3] - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[209].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[209].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = ((decimal) n[0] / (decimal) n[1]) - n[2] + n[3] * n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[210].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[210].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = ((decimal) n[0] / (decimal) n[1]) - n[2] + ((decimal)n[3] / (decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[211].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[211].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break /-+ case "-": // 4th switch /-- switch(op[d]) { case "+": resultD = ((decimal) n[0] / (decimal) n[1]) - n[2] - n[3] + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[212].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[212].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = ((decimal) n[0] / (decimal) n[1]) - n[2] - n[3] - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[213].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[213].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = ((decimal) n[0] / (decimal) n[1]) - n[2] - n[3] * n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[214].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[214].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = ((decimal) n[0] / (decimal) n[1]) - n[2] - ((decimal)n[3] / (decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[215].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[215].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break /-- case "*": // 4th switch /-* switch(op[d]) { case "+": resultD = ((decimal) n[0] / (decimal) n[1]) - n[2] * n[3] + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[216].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[216].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = ((decimal) n[0] / (decimal) n[1]) - n[2] * n[3] - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[217].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[217].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = ((decimal) n[0] / (decimal) n[1]) - n[2] * n[3] * n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[218].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[218].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = ((decimal) n[0] / (decimal) n[1]) - ((decimal) (n[2] * n[3]) / (decimal)n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[219].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[219].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break /-* case "/": // 4th switch /-/ switch(op[d]) { case "+": resultD = ((decimal) n[0] / (decimal) n[1]) - ( (decimal)n[2] / (decimal)n[3]) + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[220].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[220].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = ((decimal) n[0] / (decimal) n[1]) - ((decimal) n[2] /(decimal) n[3]) - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[221].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[221].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = (decimal) n[0] / (decimal) n[1] - (decimal) n[2] / (decimal) n[3] * n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[222].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[222].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = (decimal) n[0] / (decimal) n[1] - (decimal)n[2] / (decimal)n[3] / (decimal)n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[223].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[223].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" - "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break /-/ } break; // 2nd switch break /- case "*": //3rd switch /* switch(op[c]) { case "+": // 4th switch /*+ switch(op[d]) { case "+": resultD = ((decimal) n[0] / (decimal) n[1] * n[2]) + n[3] + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[224].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[224].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = ((decimal) n[0] / (decimal) n[1] * n[2]) + n[3] - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[225].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[225].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = ((decimal) n[0] / (decimal) n[1] * n[2]) + n[3] * n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[226].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[226].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = ((decimal) n[0] / (decimal) n[1] * n[2]) + ((decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[227].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[227].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break /*+ case "-": // 4th switch /*- switch(op[d]) { case "+": resultD = ((decimal) n[0] / (decimal) n[1] * n[2]) - n[3] + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[228].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[228].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = ((decimal) n[0] / (decimal) n[1] * n[2]) - n[3] - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[229].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[229].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = ((decimal) n[0] / (decimal) n[1] * n[2]) - n[3] * n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[230].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[230].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = ((decimal) n[0] / (decimal) n[1] * n[2]) - ((decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[231].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[231].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break /*- case "*": // 4th switch /** switch(op[d]) { case "+": resultD = ((decimal) n[0] / (decimal) n[1]) * n[2] * n[3] + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[232].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[232].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = ((decimal) n[0] / (decimal) n[1]) * n[2] * n[3] - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[233].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[233].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = ((decimal) n[0] / (decimal) n[1]) * n[2] * n[3] * n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[234].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[234].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = (((decimal) n[0] / (decimal) n[1]) * n[2] * n[3]) / (decimal) n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[235].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[235].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break /** case "/": // 4th switch /*/ switch(op[d]) { case "+": resultD = (((decimal) n[0] / (decimal) n[1] * n[2]) / (decimal) n[3]) + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[236].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[236].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = ((decimal) n[0] / (decimal) n[1] * n[2] / (decimal) n[3]) - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[237].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[237].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = (decimal) n[0] / (decimal) n[1] * (decimal) n[2] / (decimal) n[3] * (decimal) n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[238].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[238].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = ((decimal) n[0] / (decimal) n[1] * n[2] / (decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[239].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[239].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\times "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break /*/ } break; // 2nd switch break /* case "/": //3rd switch // switch(op[c]) { case "+": // 4th switch //+ switch(op[d]) { case "+": resultD = ((decimal) n[0] / (decimal) n[1] / (decimal) n[2]) + n[3] + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[240].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[240].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = ((decimal) n[0] / (decimal) n[1] / (decimal) n[2]) + n[3] - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[241].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[241].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = ((decimal) n[0] / (decimal) n[1] / (decimal) n[2]) + n[3] * n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[242].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[242].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = ((decimal) n[0] / (decimal) n[1] / (decimal) n[2]) + ((decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[243].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[243].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" + "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break //+ case "-": // 4th switch //- switch(op[d]) { case "+": resultD = ((decimal) n[0] / (decimal) n[1] / (decimal) n[2]) - n[3] + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[244].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[244].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = ((decimal) n[0] / (decimal) n[1] / (decimal) n[2]) - n[3] - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[245].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[245].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = ((decimal) n[0] / (decimal) n[1] / (decimal) n[2]) - n[3] * n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[246].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[246].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = ((decimal) n[0] / (decimal) n[1] / (decimal) n[2]) - ((decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[247].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[247].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" - "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break //- case "*": // 4th switch //* switch(op[d]) { case "+": resultD = ((decimal) n[0] / (decimal) n[1] / (decimal) n[2] * n[3]) + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[248].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[248].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = ((decimal) n[0] / (decimal) n[1] / (decimal) n[2] * n[3]) - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[249].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[249].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = ((decimal) n[0] / (decimal) n[1] / (decimal) n[2] * n[3] * n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[250].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[250].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = ((decimal) n[0] / (decimal) n[1] / (decimal) n[2] * (decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[251].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[251].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\times "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break //* case "/": // 4th switch /// switch(op[d]) { case "+": resultD = ((decimal) n[0] / (decimal) n[1] / (decimal) n[2] / (decimal) n[3]) + n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[252].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[252].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" + "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "-": resultD = ((decimal) n[0] / (decimal) n[1] / (decimal) n[2] / (decimal) n[3]) - n[4]; count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[253].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[253].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" - "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "*": resultD = ((decimal) n[0] / (decimal) n[1] / (decimal) n[2] / (decimal) n[3] * n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[254].Count()<1 && count==0 && Math.Abs(resultD)<100 ) { opQ[254].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\times "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+resultD+"\\)"); } break; case "/": resultD = ((decimal) n[0] / (decimal) n[1] / (decimal) n[2] / (decimal) n[3] / (decimal) n[4]); count = BitConverter.GetBytes(decimal.GetBits(resultD)[3])[2]; if (opQ[255].Count()<1 && Math.Abs(resultD)<100 && resultD%1==0 && count==0 ) { opQ[255].Add(" "); questions.Add(" \\item \\(\\mathmakebox[4.25cm][l]{"+n[0].ToString(fmt)+" \\div "+n[1].ToString(fmt)+" \\div "+n[2].ToString(fmt)+" \\div "+n[3].ToString(fmt)+" \\div "+n[4].ToString(fmt)+" }=\\underline{\\hspace{2cm}}\\)"+(int)resultD+"\\)"); } break; } break; // 3rd switch break /// } break; // 2nd switch break // } break; // 1st switch break / } } //Console.WriteLine(questions.Count()); questions.Shuffle(); string title1 = "Order of Operations"; string title2 = "Directed Numbers"; string exerciseTitle = "Calculate the following questions"; Print(questions, title1, exerciseTitle, 20); PrintAnswerKey(questions, title1, 20); } /***************************************************** /////////////////////LATEX CODES////////////////////// *****************************************************/ public static void PrintArithmetic<T>(List<T> list, string title) { //string title = "Title ()"; //string exerciseTitle = "Instructions"; //int m=0; //int i_final=30000; //int incre= 0; string[] latex = new string[] {"\\fontsize{16pt}{25pt}\\selectfont", " \\setlength\\itemsep{10pt}"}; string[] op = new string[2] {"(", ")("}; //string end = ")=\\)"; for (int i=0; i<list.Count(); i++){ if(i==0){ Console.WriteLine("\\begin{figure}[ht!]"); Console.WriteLine("\\vspace{-23mm}\\hspace*{-33mm}\\includegraphics[scale=0.9]{Logo.jpg}"); Console.WriteLine("\\end{figure}"); Console.WriteLine(); Console.WriteLine("\\vspace{-15mm}\\hspace*{-10mm}\\begingroup"); Console.WriteLine("\\centering"); Console.WriteLine("\\LARGE "+title+" \\\\[0.5em]"); Console.WriteLine("\\endgroup"); Console.WriteLine(); Console.WriteLine(latex[0]); //Console.WriteLine("\\subsection{Exercise "+(i/30+1)+". "+exerciseTitle+".}"); Console.WriteLine("\\begin{multicols}{2}"); Console.WriteLine(" \\begin{enumerate}[label=\\arabic*)]"); Console.WriteLine(latex[1]); } Console.WriteLine(list[i]); if (i!=0 && (i+1)%30==0){ Console.WriteLine(" \\end{enumerate}"); Console.WriteLine("\\end{multicols}"); Console.WriteLine(); Console.WriteLine("\\newpage"); Console.WriteLine(); Console.WriteLine("\\begin{figure}[ht!]"); Console.WriteLine("\\vspace{-23mm}\\hspace*{-33mm}\\includegraphics[scale=0.9]{Logo.jpg}"); Console.WriteLine("\\end{figure}"); Console.WriteLine(); Console.WriteLine("\\vspace{-15mm}\\hspace*{-10mm}\\begingroup"); Console.WriteLine("\\centering"); Console.WriteLine("\\LARGE "+title+" \\\\[0.5em]"); Console.WriteLine("\\endgroup"); Console.WriteLine(); //Console.WriteLine("\\subsection{Exercise "+((i+30)/30+1)+". "+exerciseTitle+".}"); Console.WriteLine("\\begin{multicols}{2}"); Console.WriteLine(" \\begin{enumerate}[label=\\arabic*)]"); Console.WriteLine(latex[1]); } } } public static void PrintArithmetic<T>(List<T> list, string title, int questions) { //string title = "Title ()"; //string exerciseTitle = "Instructions"; //int m=0; //int i_final=30000; //int incre= 0; string[] latex = new string[] {"\\fontsize{16pt}{25pt}\\selectfont", " \\setlength\\itemsep{10pt}"}; string[] op = new string[2] {"(", ")("}; //string end = ")=\\)"; for (int i=0; i<list.Count(); i++){ if(i==0){ Console.WriteLine("\\begin{figure}[ht!]"); Console.WriteLine("\\vspace{-23mm}\\hspace*{-33mm}\\includegraphics[scale=0.9]{Logo.jpg}"); Console.WriteLine("\\end{figure}"); Console.WriteLine(); Console.WriteLine("\\vspace{-15mm}\\hspace*{-10mm}\\begingroup"); Console.WriteLine("\\centering"); Console.WriteLine("\\LARGE "+title+" \\\\[0.5em]"); Console.WriteLine("\\endgroup"); Console.WriteLine(); Console.WriteLine(latex[0]); //Console.WriteLine("\\subsection{Exercise "+(i/questions+1)+". "+exerciseTitle+".}"); Console.WriteLine("\\begin{multicols}{2}"); Console.WriteLine(" \\begin{enumerate}[label=\\arabic*)]"); Console.WriteLine(latex[1]); } Console.WriteLine(list[i]); if (i!=0 && (i+1)%questions==0){ Console.WriteLine(" \\end{enumerate}"); Console.WriteLine("\\end{multicols}"); Console.WriteLine(); Console.WriteLine("\\newpage"); Console.WriteLine(); Console.WriteLine("\\begin{figure}[ht!]"); Console.WriteLine("\\vspace{-23mm}\\hspace*{-33mm}\\includegraphics[scale=0.9]{Logo.jpg}"); Console.WriteLine("\\end{figure}"); Console.WriteLine(); Console.WriteLine("\\vspace{-15mm}\\hspace*{-10mm}\\begingroup"); Console.WriteLine("\\centering"); Console.WriteLine("\\LARGE "+title+" \\\\[0.5em]"); Console.WriteLine("\\endgroup"); Console.WriteLine(); //Console.WriteLine("\\subsection{Exercise "+((i+questions)/questions+1)+". "+exerciseTitle+".}"); Console.WriteLine("\\begin{multicols}{2}"); Console.WriteLine(" \\begin{enumerate}[label=\\arabic*)]"); Console.WriteLine(latex[1]); } } } public static void Print<T>(List<T> list, string title, string exerciseTitle) { //string title = "Title ()"; //string exerciseTitle = "Instructions"; //int m=0; //int i_final=30000; //int incre= 0; string[] latex = new string[] {"\\fontsize{12pt}{16pt}\\selectfont", " \\setlength\\itemsep{2em}"}; string[] op = new string[2] {"(", ")("}; //string end = ")=\\)"; for (int i=0; i<list.Count(); i++){ if(i==0){ Console.WriteLine("\\begin{figure}[ht!]"); Console.WriteLine("\\vspace{-23mm}\\hspace*{-23mm}\\includegraphics[scale=0.9]{Logo.jpg}"); Console.WriteLine("\\end{figure}"); Console.WriteLine(); Console.WriteLine("\\vspace{-15mm}\\begingroup"); Console.WriteLine("\\centering"); Console.WriteLine("\\LARGE "+title+" \\\\[0.5em]"); Console.WriteLine("\\endgroup"); Console.WriteLine(); Console.WriteLine(latex[0]); Console.WriteLine("\\subsection{Exercise "+(i/30+1)+". "+exerciseTitle+".}"); Console.WriteLine("\\begin{multicols}{2}"); Console.WriteLine(" \\begin{enumerate}[label=\\arabic*)]"); Console.WriteLine(latex[1]); } Console.WriteLine(list[i]); if (i!=0 && (i+1)%30==0){ Console.WriteLine(" \\end{enumerate}"); Console.WriteLine("\\end{multicols}"); Console.WriteLine(); Console.WriteLine("\\newpage"); Console.WriteLine(); Console.WriteLine("\\begin{figure}[ht!]"); Console.WriteLine("\\vspace{-23mm}\\hspace*{-23mm}\\includegraphics[scale=0.9]{Logo.jpg}"); Console.WriteLine("\\end{figure}"); Console.WriteLine(); Console.WriteLine("\\vspace{-15mm}\\begingroup"); Console.WriteLine("\\centering"); Console.WriteLine("\\LARGE "+title+" \\\\[0.5em]"); Console.WriteLine("\\endgroup"); Console.WriteLine(); Console.WriteLine(latex[0]); Console.WriteLine("\\subsection{Exercise "+((i+30)/30+1)+". "+exerciseTitle+".}"); Console.WriteLine("\\begin{multicols}{2}"); Console.WriteLine(" \\begin{enumerate}[label=\\arabic*)]"); Console.WriteLine(latex[1]); } } } public static void PrintAnswerKey<T>(List<T> list, string title, int questions) { int p = 5; // number of pages before new page Console.WriteLine(); Console.WriteLine("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"); Console.WriteLine(); Console.WriteLine("\\newpage"); Console.WriteLine(); Console.WriteLine("\\newgeometry{"); Console.WriteLine(" a4paper,"); Console.WriteLine(" total={170mm,257mm},"); Console.WriteLine(" left=15mm,"); // 10mm for fractions Console.WriteLine(" top=20mm,"); Console.WriteLine(" bottom=20mm,"); Console.WriteLine(" right=15mm"); //10mm for fractions Console.WriteLine(" }"); Console.WriteLine("\\fontsize{10pt}{10pt}\\selectfont"); Console.WriteLine(); Console.WriteLine("\\section{"+title+" Answer Key}"); for (int i=0; i<list.Count(); i++){ if(i==0){ Console.WriteLine("\\textbf{p"+(i/questions+1)+"}"); Console.WriteLine(); Console.WriteLine("\\begin{multicols}{5}"); Console.WriteLine(" \\begin{enumerate}[label=\\arabic*)]"); } Console.WriteLine(list[i]); if (i!=0 && (i+1)%(questions*p)==0){ Console.WriteLine(" \\end{enumerate}"); Console.WriteLine("\\end{multicols}"); Console.WriteLine(); Console.WriteLine("\\newpage"); Console.WriteLine(); Console.WriteLine("\\textbf{p"+((i+questions)/questions+1)+"}"); Console.WriteLine(); Console.WriteLine("\\begin{multicols}{5}"); Console.WriteLine(" \\begin{enumerate}[label=\\arabic*)]"); } if (i!=0 && (i+1)%questions==0 && (i+1)%(questions*p)!=0){ Console.WriteLine(" \\end{enumerate}"); Console.WriteLine("\\end{multicols}"); Console.WriteLine(); Console.WriteLine("\\textbf{p"+((i+questions)/questions+1)+"}"); Console.WriteLine("\\begin{multicols}{5}"); Console.WriteLine(" \\begin{enumerate}[label=\\arabic*)]"); } } } public static void Print<T>(List<T> list, string title, string exerciseTitle, int questions) { //string title = "Title ()"; //string exerciseTitle = "Instructions"; //int m=0; //int i_final=30000; //int incre= 0; string[] latex = new string[] {"\\fontsize{12pt}{16pt}\\selectfont", " \\setlength\\itemsep{2em}"}; string[] op = new string[2] {"(", ")("}; //string end = ")=\\)"; for (int i=0; i<list.Count(); i++){ if(i==0){ Console.WriteLine("\\begin{figure}[ht!]"); Console.WriteLine("\\vspace{-23mm}\\hspace*{-23mm}\\includegraphics[scale=0.9]{Logo.jpg}"); Console.WriteLine("\\end{figure}"); Console.WriteLine(); Console.WriteLine("\\vspace{-15mm}\\begingroup"); Console.WriteLine("\\centering"); Console.WriteLine("\\LARGE "+title+" \\\\[0.5em]"); Console.WriteLine("\\endgroup"); Console.WriteLine(); Console.WriteLine(latex[0]); Console.WriteLine("\\subsection{Exercise "+(i/questions+1)+". "+exerciseTitle+".}"); Console.WriteLine("\\begin{multicols}{2}"); Console.WriteLine(" \\begin{enumerate}[label=\\arabic*)]"); Console.WriteLine(latex[1]); } Console.WriteLine(list[i]); if (i!=0 && (i+1)%questions==0){ Console.WriteLine(" \\end{enumerate}"); Console.WriteLine("\\end{multicols}"); Console.WriteLine(); Console.WriteLine("\\newpage"); Console.WriteLine(); Console.WriteLine("\\begin{figure}[ht!]"); Console.WriteLine("\\vspace{-23mm}\\hspace*{-23mm}\\includegraphics[scale=0.9]{Logo.jpg}"); Console.WriteLine("\\end{figure}"); Console.WriteLine(); Console.WriteLine("\\vspace{-15mm}\\begingroup"); Console.WriteLine("\\centering"); Console.WriteLine("\\LARGE "+title+" \\\\[0.5em]"); Console.WriteLine("\\endgroup"); Console.WriteLine(); Console.WriteLine(latex[0]); Console.WriteLine("\\subsection{Exercise "+((i+questions)/questions+1)+". "+exerciseTitle+".}"); Console.WriteLine("\\begin{multicols}{2}"); Console.WriteLine(" \\begin{enumerate}[label=\\arabic*)]"); Console.WriteLine(latex[1]); } } } public static void PrintFraction<T>(List<T> list, string title, string exerciseTitle) { //string title = "Title ()"; //string exerciseTitle = "Instructions"; //int m=0; //int i_final=30000; //int incre= 0; string[] latex = new string[] {"\\fontsize{12pt}{16pt}\\selectfont", " \\setlength\\itemsep{1.8em}"}; string[] op = new string[2] {"(", ")("}; //string end = ")=\\)"; for (int i=0; i<list.Count(); i++){ if(i==0){ Console.WriteLine("\\begin{figure}[ht!]"); Console.WriteLine("\\vspace{-23mm}\\hspace*{-23mm}\\includegraphics[scale=0.9]{Logo.jpg}"); Console.WriteLine("\\end{figure}"); Console.WriteLine(); Console.WriteLine("\\vspace{-15mm}\\hspace*{-10mm}\\begingroup"); Console.WriteLine("\\centering"); Console.WriteLine("\\LARGE "+title+" \\\\[0.5em]"); Console.WriteLine("\\endgroup"); Console.WriteLine(); //Console.WriteLine(latex[0]); Console.WriteLine("\\vspace{-5mm}\\subsection{Exercise "+(i/20+1)+". "+exerciseTitle+".}"); //Console.WriteLine("\\begin{tasks}(2)"); Console.WriteLine("\\begin{multicols}{2}"); Console.WriteLine(" \\begin{enumerate}[label=\\arabic*)]"); Console.WriteLine(latex[1]); } Console.WriteLine(list[i]); if (i!=0 && (i+1)%20==0){ //Console.WriteLine("\\end{tasks}"); Console.WriteLine(" \\end{enumerate}"); Console.WriteLine("\\end{multicols}"); Console.WriteLine(); Console.WriteLine("\\newpage"); Console.WriteLine(); Console.WriteLine("\\begin{figure}[ht!]"); Console.WriteLine("\\vspace{-23mm}\\hspace*{-23mm}\\includegraphics[scale=0.9]{Logo.jpg}"); Console.WriteLine("\\end{figure}"); Console.WriteLine(); Console.WriteLine("\\vspace{-15mm}\\hspace*{-10mm}\\begingroup"); Console.WriteLine("\\centering"); Console.WriteLine("\\LARGE "+title+" \\\\[0.5em]"); Console.WriteLine("\\endgroup"); Console.WriteLine(); //Console.WriteLine(latex[0]); Console.WriteLine("\\subsection{Exercise "+((i+20)/20+1)+". "+exerciseTitle+".}"); //Console.WriteLine("\\begin{tasks}(2)"); Console.WriteLine("\\begin{multicols}{2}"); Console.WriteLine(" \\begin{enumerate}[label=\\arabic*)]"); Console.WriteLine(latex[1]); } } } public static long GCD(long a, long b) { return b == 0 ? a : GCD(b, a % b); } public static long GCD(long a, long b, long c) { return GCD(a, GCD(b,c)); } public static int lcm(int a, int b) { int lcm; int a_r=a; int b_r=b; int d=max(a_r,b_r); while(d>1) { if (a_r%d==0 && b_r%d==0) { int a_r_temp=a_r/d; int b_r_temp=b_r/d; a_r=a_r_temp; b_r=b_r_temp; lcm=d*a_r*b_r; break; } d--; } return d*a_r*b_r; //Console.WriteLine("LCM({0},{1}): {2}", a,b,lcm); } public static int lcm(int a, int b, int c) { return lcm(a,lcm(b,c)); } public static int max(int a, int b) { if (a>b){ return a; } else if (b>a){ return b; } else { return a; } } public static int max(int a, int b, int c) { return max(a,max(b,c)); } public static int min(int a, int b) { if (a>b){ return b; } else if (b>a){ return a; } else { return a; } } public static int min(int a, int b, int c) { return min(a,min(b,c)); } public static void SimplifyRatio(int ratio1, int ratio2, int ratio3) { int divisor; if (ratio1>ratio2 && ratio1>ratio3) { divisor = ratio1; } else if (ratio2>ratio1 && ratio2>ratio3) { divisor = ratio2; } else divisor = ratio3; int ratio1_reduce = ratio1; int ratio2_reduce = ratio2; int ratio3_reduce = ratio3; while (divisor!=1) { if(ratio1_reduce%divisor==0 && ratio2_reduce%divisor==0 && ratio3_reduce%divisor==0){ int ratio1_reduce_temp = ratio1_reduce/divisor; int ratio2_reduce_temp = ratio2_reduce/divisor; int ratio3_reduce_temp = ratio3_reduce/divisor; ratio1_reduce = ratio1_reduce_temp; ratio2_reduce = ratio2_reduce_temp; ratio3_reduce = ratio3_reduce_temp; divisor--; } else divisor--; } Console.WriteLine(ratio1+":"+ratio2+":"+ratio3+" = "+ratio1_reduce+":"+ratio2_reduce+":"+ratio3_reduce); } } public static class Rand { /// <summary> /// Random number generator used to generate seeds, /// which are then used to create new random number /// generators on a per-thread basis. /// </summary> private static readonly Random globalRandom = new Random(); private static readonly object globalLock = new object(); /// <summary> /// Random number generator /// </summary> private static readonly ThreadLocal<Random> threadRandom = new ThreadLocal<Random>(NewRandom); /// <summary> /// Creates a new instance of Random. The seed is derived /// from a global (static) instance of Random, rather /// than time. /// </summary> public static Random NewRandom() { lock (globalLock) { return new Random(globalRandom.Next()); } } /// <summary> /// Returns an instance of Random which can be used freely /// within the current thread. /// </summary> public static Random Instance { get { return threadRandom.Value; } } /// <summary>See <see cref="Random.Next()" /></summary> public static int Next() { return Instance.Next(); } /// <summary>See <see cref="Random.Next(int)" /></summary> public static int Next(int maxValue) { return Instance.Next(maxValue); } /// <summary>See <see cref="Random.Next(int, int)" /></summary> public static int Next(int minValue, int maxValue) { return Instance.Next(minValue, maxValue); } public static int NextPM(int minValue, int maxValue) { // positive if (Rand.Next(0,2)==0) { return Instance.Next(minValue, maxValue); } else return -Instance.Next(minValue, maxValue); } /// <summary>See <see cref="Random.NextDouble()" /></summary> public static double NextDouble() { return Instance.NextDouble(); } /// <summary>See <see cref="Random.NextBytes(byte[])" /></summary> public static void NextBytes(byte[] buffer) { Instance.NextBytes(buffer); } public static double NextD(double minValue, double maxValue) { return Instance.NextDouble()*(maxValue-minValue)+minValue; } } } namespace ShuffleExtension { public static class ShuffleExtend { //private static readonly Random rnd = new Random(); public static void Shuffle<T>(this IList<T> list) { int n = list.Count; while (n > 1) { int k = (Rextester.Rand.Next(0, n) % n); n--; T value = list[k]; list[k] = list[n]; list[n] = value; } } } } namespace CountExtension { public static class CountExtension { public static int Count(this int n) { //return (Value == 0 ? 1 : ((int)Math.Floor(Math.Log10(Math.Abs(Value))) + 1)); return (n == 0 ? 1 : (int)Math.Log10(Math.Abs(n)) + 1); } } } namespace MathSpace { public struct Fraction { public long num; public long denom; public long integer; public long Num { get { return num; } set { num = value; } } public long Denom { get { return denom; } set { denom = value; } } public long Integer { get { return integer; } set { integer = value; } } public Fraction(int num, int denom) { // num + denom - if (num > 0 && denom < 0) { this.num = -num; this.denom = Math.Abs(denom); this.integer = 0; } // num - denom + else if (num < 0 && denom > 0 ) { this.num = -Math.Abs(num); this.denom = Math.Abs(denom); this.integer = 0; } // both positive or negative or zero else { this.num = Math.Abs(num); this.denom = Math.Abs(denom); this.integer = 0; } } public Fraction(long num, long denom) { // num + denom - if (num > 0 && denom < 0) { this.num = -num; this.denom = Math.Abs(denom); this.integer = 0; } // num - denom + else if (num < 0 && denom > 0 ) { this.num = num; this.denom = Math.Abs(denom); this.integer = 0; } // both positive or negative or zero else { this.num = Math.Abs(num); this.denom = Math.Abs(denom); this.integer = 0; } } public Fraction(int integer, int num, int denom) { if (num*denom<0) throw new ArgumentException("Numerator and Denominator must be positive."); // all + or only two + if (integer * num * denom > 0 ) { this.integer = Math.Abs(integer); this.num = Math.Abs(num); this.denom = Math.Abs(denom); } // if an odd - else { this.integer = -integer; this.num = Math.Abs(num); this.denom = Math.Abs(denom); } } public Fraction(long integer, long num, long denom) { if (num*denom<0) throw new ArgumentException("Numerator and Denominator must be positive."); // all + or only two + if (integer * num * denom > 0 ) { this.integer = Math.Abs(integer); this.num = Math.Abs(num); this.denom = Math.Abs(denom); } // if an odd - else { this.integer = -integer; this.num = Math.Abs(num); this.denom = Math.Abs(denom); } } public Fraction (Fraction left, int right) { Fraction result = left/right; this.num = result.num; this.denom = result.denom; this.integer = 0; } public Fraction (int left, Fraction right) { Fraction result = left/right; this.num = result.num; this.denom = result.denom; this.integer = 0; } public Fraction (Fraction left, Fraction right) { Fraction result = left/right; this.num = result.num; this.denom = result.denom; this.integer = 0; } public Fraction toMixed() { if (this.integer == 0 && (this.num < 0 || this.denom < 0)) { return new Fraction(this.num / this.denom, Math.Abs(this.num % this.denom), Math.Abs(this.denom)); } else if (this.integer == 0 && (this.num * this.denom > 0)) { return new Fraction(this.num / this.denom, this.num % this.denom, this.denom); } else return new Fraction(this.integer + this.num / this.denom, this.num % this.denom, this.denom); } public Fraction toImproper() { if (this.integer!=0 && this.integer<0) { return new Fraction (-(Math.Abs(this.integer)*Math.Abs(this.denom)+Math.Abs(this.num)),Math.Abs(this.denom)); } else if (this.integer!=0 && this.integer>0) { return new Fraction (Math.Abs(this.integer)*Math.Abs(this.denom)+Math.Abs(this.num),Math.Abs(this.denom)); } else return new Fraction (this.num,this.denom); } public override string ToString() { if (this.denom == 0) { return "Div by 0"; } // if fraction is proper or improper fraction if (this.denom != 1 && this.integer == 0 && this.num%this.denom!=0) { // if fraction is negative (either num or denom negative but not both) if ((this.num < 0 || this.denom < 0 ) && !(this.num<0 && this.denom<0) ) { this.denom = Math.Abs(this.denom); return this.num + "/" + this.denom; } // if fraction is positive else return num + "/" + denom; // + ", " + num/denom + " " + num%denom + "/" + denom; } //if fraction is mixed number else if (this.denom != 1 && this.integer != 0 && this.num%this.denom!=0) { var new_integer = Math.Abs(this.integer) + this.num/this.denom; var new_num = this.num % this.denom; this.integer = new_integer; this.num = new_num; // if fraction is negative (either num or denom negative but not both) if (this.integer < 0) { return this.integer + " " + this.num + "/" + this.denom; } // if fraction is positive else return this.integer + " " + this.num + "/" + this.denom; } // if denom not 1 and numerator is a multiple of the denominator (ie. 4/2 ==> 2) and not mixed number (result is integer) else if (this.num % this.denom == 0 && this.integer==0) { return (this.num / this.denom).ToString(); } // if denom not 1 and numerator is a multiple of the denominator (ie. 4/2 ==> 2) and mixed number (result is integer) else if (this.num % this.denom == 0 && this.integer!=0) { return (this.integer+(this.num / this.denom)).ToString(); } // if denominator is 1, ie., whole number and not mixed number else if (this.integer!=0) { return (integer+num).ToString(); } else return num.ToString(); } public Fraction Simplify() { int divisor = Convert.ToInt32(GCD(this.num, this.denom)); if (this.denom != 0 && this.integer==0 && this.num >0) { return new Fraction(this.num / divisor, this.denom / divisor); } else if (this.denom != 0 && this.integer==0 && this.num <0) { return new Fraction(-Math.Abs(this.num / divisor), Math.Abs(this.denom / divisor)); } else if (this.denom != 0 && this.integer!=0) { return new Fraction(this.integer, this.num / divisor, this.denom / divisor); } else return new Fraction (this.num, this.denom); } public static long GCD(long a, long b) { return b == 0 ? a : GCD(b, a % b); } public Fraction Reciprocal() { return new Fraction(this.Denom, this.Num); } public static Fraction operator +(Fraction left, Fraction right) { Fraction result; if (left.integer==0 &&right.integer==0){ result = new Fraction(left.num * right.denom + right.num * left.denom, left.denom * right.denom); } else { //result = new Fraction((left.integer*left.denom+left.num)*right.denom+(right.integer*right.denom+right.num)*left.denom, left.denom * right.denom); result = (new Fraction(left.integer+right.integer, left.num * right.denom + right.num * left.denom, left.denom * right.denom)).toMixed(); } return result.toMixed().Simplify(); } public static Fraction operator +(int left, Fraction right) { Fraction result; if (right.integer==0) { result = new Fraction(left * right.denom + right.num, right.denom); } else { result = (new Fraction(left+right.integer, right.num, right.denom)).toMixed(); } return result.Simplify(); } public static Fraction operator +(Fraction left, int right) { Fraction result; if (left.integer==0) { result = new Fraction(left.num + left.denom * right, left.denom); } else { result = (new Fraction(left.integer+right, left.denom)).toMixed(); } return result.Simplify(); } public static Fraction operator -(Fraction frac) { if (frac.integer==0) { return new Fraction(-frac.num,frac.denom); } else return (new Fraction (-frac.integer,frac.num,frac.denom)).toMixed(); } public static Fraction operator -(Fraction left, Fraction right) { Fraction result; if (left.integer==0 && right.integer==0) { result = (new Fraction(left.num * right.denom - right.num * left.denom, left.denom * right.denom)).toMixed(); } else { if (((left.integer*left.denom+left.num)/left.denom)>=((right.integer*right.denom+right.num)/right.denom)) { result = (left.toImproper()-right.toImproper()).toMixed(); } else result = (left.toImproper()-right.toImproper()).toMixed(); } return result.Simplify(); } public static Fraction operator -(int left, Fraction right) { Fraction result; if (right.integer==0) { result = new Fraction(left * right.denom - right.num, right.denom); } else result = (new Fraction(left * right.denom - right.toImproper().num, right.denom)).toMixed(); return result.Simplify(); } public static Fraction operator -(Fraction left, int right) { Fraction result; if (left.integer==0) { result = new Fraction(left.num - left.denom * right, left.denom); } // if mixed numbers else result = (new Fraction(left.toImproper().num - left.denom * right, left.denom)).toMixed(); return result.Simplify(); } public static Fraction operator *(Fraction left, Fraction right) { Fraction result; if (left.integer==0 && right.integer==0){ result = new Fraction(left.num * right.num, Math.Abs(left.denom * right.denom)); } // if mixed numbers else result = (left.toImproper()*right.toImproper()).toMixed(); return result.Simplify(); } public static Fraction operator *(int left, Fraction right) { Fraction result; if (right.integer==0){ result = new Fraction(left * right.num, right.denom); } else result = (new Fraction(right.toImproper().num * left, right.denom)).toMixed(); return result.Simplify(); } public static Fraction operator *(Fraction left, int right) { Fraction result; // if improper fraction if (left.integer==0){ result = new Fraction(left.num * right, left.denom); } // if mixed numbers else result = (new Fraction(left.toImproper().num * right, left.denom)).toMixed(); return result.Simplify(); } public static Fraction operator /(Fraction left, Fraction right) { Fraction result; if (left.integer==0 &&right.integer==0){ result = left * right.Reciprocal(); } else result = (left.toImproper() * right.toImproper().Reciprocal()).toMixed(); return result.Simplify(); } public static Fraction operator /(int left, Fraction right) { Fraction result; if (right.integer==0) { result = left * right.Reciprocal(); } else result = left * right.toImproper().Reciprocal(); return result.Simplify(); } public static Fraction operator /(Fraction left, int right) { Fraction rightRecip = new Fraction(1,right); Fraction result; if (left.integer==0) { result = left * rightRecip; } else { result = left.toImproper() * rightRecip; } return result.Simplify(); } public static int LCM(int a, int b) { int lcm; int a_r = a; int b_r = b; int d = max(a_r, b_r); while (d > 1) { if (a_r % d == 0 && b_r % d == 0) { int a_r_temp = a_r / d; int b_r_temp = b_r / d; a_r = a_r_temp; b_r = b_r_temp; lcm = d * a_r * b_r; break; } d--; } lcm = d * a_r * b_r; return lcm; } public static int LCM(long a, long b) { int lcm; long a_r = a; long b_r = b; int d = Convert.ToInt32(max(a_r, b_r)); while (d > 1) { if (a_r % d == 0 && b_r % d == 0) { long a_r_temp = a_r / d; long b_r_temp = b_r / d; a_r = a_r_temp; b_r = b_r_temp; lcm = Convert.ToInt32(d * a_r * b_r); break; } d--; } lcm = Convert.ToInt32(d * a_r * b_r); return lcm; } public static int max(int a, int b) { if (a > b) { return a; } else if (b > a) { return b; } else { return a; } } public static long max(long a, long b) { if (a > b) { return a; } else if (b > a) { return b; } else { return a; } } public double toDeci() { if (this.integer==0) { return (double) this.num/this.denom; } else { return (double) (this.integer*this.denom+this.num)/this.denom; } } public static Fraction toFrac(double deci) { /*List<double> d = new List<double>(); List<double> z = new List<double>(); List<double> n = new List<double>();*/ double[] d = new double[6]; double[] z = new double[6]; double[] n = new double[6]; z[1] = deci; //X d[0] = 0; d[1] = 1; for (int i = 1; i < 5; i++) { z[i + 1] = 1 / (z[i] - Math.Floor(z[i])); d[i + 1] = d[i] * Math.Floor(z[i + 1]) + d[i - 1]; n[i + 1] = Math.Round(z[1] * d[i + 1]); } int num, denom; num = (int)n[5]; denom = (int)d[5]; return new Fraction(num, denom); } public static Fraction Parse(string input) { if (String.IsNullOrWhiteSpace(input)) { throw new ArgumentNullException(); } //var instance = new Fraction(); // checks if there is more than one "/" if (input.IndexOf("/") != input.LastIndexOf("/")) { throw new ArgumentException(); } //return instance; int v; // if (input.IndexOf("/") != -1) { if (int.TryParse(input.Substring(0, input.IndexOf("/")), out v) && int.TryParse(input.Substring(input.IndexOf("/") + 1), out v)) { int num1 = int.Parse(input.Substring(0, input.IndexOf("/"))); int denom1 = int.Parse(input.Substring(input.IndexOf("/") + 1)); var frac = new Fraction(num1, denom1); return frac; } else throw new IndexOutOfRangeException(); } else // if { if (int.TryParse(input, out v)) { return new Fraction(int.Parse(input), 1); } else throw new IndexOutOfRangeException(); } } public static bool TryParse(string input, out Fraction frac) { if (string.IsNullOrWhiteSpace(input)) { frac = new Fraction(0, 0); return false; } if (input.IndexOf("/") == -1 || input.IndexOf("/") != input.LastIndexOf("/")) { frac = new Fraction(0, 0); return false; } long v; if (long.TryParse(input.Substring(0, input.IndexOf("/")), out v) && long.TryParse(input.Substring(input.IndexOf("/") + 1), out v)) { frac = new MathSpace.Fraction(1, 1); v = 1; return true; } else frac = new Fraction(0, 0); return false; } public static Fraction ConvertFrom(object obj) { Fraction frac = new MathSpace.Fraction(0, 0); if (obj.GetType() == frac.GetType()) { frac = (Fraction) obj; return frac; } else throw new NotSupportedException(); } public static double ConvertToDecimal(Fraction frac) { return Convert.ToDouble(frac.Num) / Convert.ToDouble(frac.Denom); } public static double operator +(Fraction left, double right) { double result = ConvertToDecimal(left) + right; return result; } public static double operator +(double left, Fraction right) { double result = left + ConvertToDecimal(right); return result; } public static double operator -(Fraction left, double right) { double result = ConvertToDecimal(left) - right; return result; } public static double operator -(double left, Fraction right) { double result = left - ConvertToDecimal(right); return result; } public static double operator *(Fraction left, double right) { double result = ConvertToDecimal(left) * right; return result; } public static double operator *(double left, Fraction right) { double result = left * ConvertToDecimal(right); return result; } public static double operator /(Fraction left, double right) { double result = ConvertToDecimal(left) / right; return result; } public static double operator /(double left, Fraction right) { double result = left / ConvertToDecimal(right); return result; } public static Fraction Pow(Fraction frac, int n) { long num_new = (long) Math.Pow(frac.Num, n); long denom_new = (long) Math.Pow(frac.Denom, n); return new MathSpace.Fraction(num_new, denom_new); } } }
run
|
edit
|
history
|
help
0
Prac1_A
hivix
equation with a variable on the 2nd power
Chest Interaction Unity
Ejercicio bucles
async example with HttpClient
Main5.2
Dictionary that tells which key was not present
Assignment
Delegate & anonymous method