fork(1) download
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string input = string.Empty;
  9. int output = 0;
  10. do
  11. {
  12. Console.WriteLine("Enter number: ");
  13. input = /* Console.ReadLine() */ "8";
  14. } while (!int.TryParse(input, out output));
  15. int[] first = new int[] {0,1,2,3,4,5,6,7,8,9};
  16. int[] second = new int[] {0,1,2,3,4,5,6,7,8,9};
  17. var list = new List<string>();
  18. for (int i = 0; i < first.Length; i++)
  19. for (int j = 0; j < second.Length; j++)
  20. if (first[i] * second[j] == output)
  21. list.Add(first[i] + " x " + second[j] + " = " + output);
  22. foreach (var str in list) {
  23. Console.WriteLine(str);
  24. }
  25. }
  26. }
Success #stdin #stdout 0.01s 29664KB
stdin
7
stdout
Enter number: 
1 x 8 = 8
2 x 4 = 8
4 x 2 = 8
8 x 1 = 8