Write an application Output10Times

Paper test in interview:

Use below functions to finish a function that multiply one integer 10 times.

  • Console.WriteLine()
  • Console,ReadKey()
  • String.Format()
  • Int32.TryParse()

To show result like:

Please input an integer:

good!

Please input an integer:

6.4313

Please input an integer:

67

0 * 67 =0
1 * 67 =67
2 * 67 =134
3 * 67 =201
4 * 67 =268
5 * 67 =335
6 * 67 =402
7 * 67 =469
8 * 67 =536
9 * 67 =603

=================================================================================================

public void Output10Times()

{

    int n = 0;
BEGIN:
    Console.WriteLine("Please input an integer:");
    if (Int32.TryParse(Console.ReadLine(), out n))
    {
    for (int i = 0; i < 10; i++)
        Console.WriteLine(String.Format("{0} * {1} ={2}", i, n, i * n));
    return;
    }
    goto BEGIN;

}

New Bitmap Image

原文地址:https://www.cnblogs.com/diggingdeeply/p/Write_an_application_Output10Times.html