Advertisement
Guest User

Untitled

a guest
Dec 10th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. class Program
  2. {
  3. static void Main(string[] args)
  4. {
  5. int[] a = new int[] { 1, 3, 4, 5, 8, 5, 5, 8};
  6. Console.WriteLine(place(a, 5, 0));
  7. }
  8.  
  9. public static int place(int[] a, int n, int p)
  10. {
  11. if (p < a.Length)
  12. {
  13. if (a[p] == n)
  14. return place(a, n, p++) + 1;
  15. else return place(a, n, p++);
  16. }
  17. return 0;
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement