Advertisement
Guest User

Untitled

a guest
Sep 21st, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. using System;
  2.  
  3. public class Program
  4. {
  5. public static void Main()
  6. {
  7. int[] nums = new int[5];
  8. int a;
  9. int arraySeq;
  10. int target;
  11. bool reset = true;
  12.  
  13. do
  14. {
  15. for (arraySeq = 0; arraySeq < nums.Length; arraySeq++)
  16. {
  17. for (a = 1; a <= arraySeq; a++) { }
  18.  
  19. Console.Write("insert the number #" + a + " = ");
  20. nums[arraySeq] = int.Parse(Console.ReadLine());
  21. for (int i = 0; i < arraySeq; i++)
  22. {
  23. if (nums[arraySeq] == nums[i])
  24. {
  25. reset = true;
  26. Console.WriteLine("You can't insert the same number");
  27. Console.ReadKey();
  28. Console.Clear();
  29. break;
  30. }
  31. else
  32. {
  33. reset = false;
  34. }
  35. }
  36. if(reset == true)break;
  37. }
  38. }while(reset == true);
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement