Welcome :Guest

Congratulations!!!

 Home >> Code Snippets >> Visual Studio >> Post New Resource

# Number Game

Posted By:laptop charles       Posted Date: August 13, 2010    Points: 10    Category: Visual Studio    URL: http://www.dotnetspark.com

Number game get a digit then will give the answer in previously .

*It just simply get the digit then will give the answer.
*then will give the two another input for same digit.
```using System;
using System.Collections.Generic;
using System.Text;

namespace Number_game
{
class Program
{
static void Main(string[] args)
{
int num,in1,in2,tot1;
string  fin="";

int totnum;

int[] dig=new int[20];

for (int i = 0; i <= 79; i++)
{
Console.Write("*");
}
Console.WriteLine("\t\t\t   NUMBER GAME BY CHARLES");
for (int i = 0; i <= 79; i++)
{
Console.Write("*");
}

Console.WriteLine("\t\t\tEnter More Digit You Like ");
Console.Write("\t\t\t");
for (int i = 0; i <= 79; i++)
{
Console.Write("*");
}

totnum = int.Parse(2 + "" + (num));
Console.WriteLine("\t\t\tAnswer Is  \" " + (totnum - 2)+"\"");

for (int i = 0; i <= 79; i++)
{
Console.Write("*");
}

second:
Console.WriteLine("\t\t\tEnter Another " + num.ToString().Length + " Digits");
Console.Write("\t\t\t");

if (num.ToString().Length == in1.ToString().Length)
{
thrid:
Console.WriteLine("\t\t\tEnter Another " + num.ToString().Length + " Digits");
Console.Write("\t\t\t");
if (num.ToString().Length == in2.ToString().Length)
{
goto first;
}
else
{
Console.WriteLine("\t\t\tInvalid Digit It Accept Only " + num.ToString().Length + " Digits");
goto thrid;
}

}
else
{
Console.WriteLine("\t\t\tInvalid Digit It Accept Only " + num.ToString().Length + " Digits");
goto second;
}

first:

for (int i = 0; i < in1.ToString().Length; i++)
{
fin=9+""+fin;
}

tot1 = int.Parse(fin);

for (int i = 0; i <= 79; i++)
{
Console.Write("*");
}

for (int i = 0; i <= 79; i++)
{
Console.Write("-");
}

Console.WriteLine("\t\t\t\t"+num);
Console.WriteLine("\t\t\t\t"+in1);
Console.WriteLine("\t\t\t\t"+(tot1 - in1));
Console.WriteLine("\t\t\t\t"+in2);
Console.WriteLine("\t\t\t\t"+(tot1 - in2));
for (int i = 0; i <= 79; i++)
{
Console.Write("-");
}

Console.WriteLine("Game Is Over See The Answer    " + (num + tot1 + tot1));

for (int i = 0; i <= 79; i++)
{
Console.Write("-");
}

for (int i = 0; i <= 79; i++)
{
Console.Write("*");
}

}
}
}
```

Responses

No response found. Be the first to respond this post

Post Comment