-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGenerateCode.cs
More file actions
34 lines (29 loc) · 1.15 KB
/
GenerateCode.cs
File metadata and controls
34 lines (29 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
namespace generateCalcCode
{
class GenerateCode
{
static void Main(string[] args)
{
int amount = 51;
string output = "";
//i and j have to be set to 1 instead of 0 when creating code for division!!!!!
for(int i = 0; i < amount; i++)
{
for (int j = 0; j < amount; j++)
{
//add
//output += "if (num1 == " + i + " && num2 == " + j + ") \n{\n\treturn " + (i + j) + ";\n}";
//subtract
//output += "if (num1 == " + i + " && num2 == " + j + ") \n{\n\treturn " + (i - j) + ";\n}";
//multiply
//output += "if (num1 == " + i + " && num2 == " + j + ") \n{\n\treturn " + (i * j) + ";\n}";
//divide
//output += "if (num1 == " + i + " && num2 == " + j + ") \n{\n\treturn " + ((double)i / (double)j).ToString().Replace(",", ".") + ";\n}";
}
}
Console.WriteLine(output);
Console.ReadLine();
}
}
}