Solution
Check each and every number index. The number is available in the array it will return that number index or it will return -1. After we get index, check the condition is equal to -1 or not. If index equal to -1, that number will print in the Console. Then, check, that number equal to 100. If This not equal to 100, the Increment operator increases value and go to the loop line.
  1. using System;
  2. namespace PlayingwithCSharp
  3. {
  4. public class Print1To100MissingNumberInArrayWithoutLoop
  5. {

  6. public static void MissingNumber()
  7. {
  8. int[] givenArray = new int[99];
  9. int incrementValue = 1, arrayPosion = 0 , one = 1 ;
  10. #region Assign Value to Array
  11. //givenArray[incrementValue] = incrementValue(incrementValue - 1);
  12. givenArray[0] = 1;
  13. givenArray[1] = 46;
  14. givenArray[2] = 34;
  15. givenArray[3] = 23;
  16. givenArray[4] = 26;
  17. #endregion
  18. Array.Sort(givenArray);
  19. Loop:
  20. var isPosition = Array.IndexOf(givenArray, incrementValue);
  21. if(isPosition == -1)
  22. {
  23. System.Console.Write(incrementValue + " ");
  24. if (incrementValue != 100)
  25. {
  26. arrayPosion++;
  27. incrementValue++;
  28. goto Loop;
  29. }
  30. else
  31. {
  32. System.Console.WriteLine("\nMissing Value 1 to 100 Printed Above");
  33. }
  34. }
  35. else
  36. {
  37. if (incrementValue == 100)
  38. {
  39. System.Console.WriteLine("\nMissing Value 1 to 100 Printed Above");
  40. }
  41. else
  42. {
  43. incrementValue++;
  44. goto Loop;
  45. }
  46. }
  47. Console.ReadLine();
  48. }
  49. }
  50. }
  51. // Input : Given Array
  52. // 1, 46, 34, 23, 26
  53. // Output : Missing element
  54. // 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24 25 27 28 29 30 31 32 33 35 36 37 38 39 40 41 42 43 44 45 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
  55. // 96 97 98 99 100
  56. // Missing Value 1 to 100 Printed Above