MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / takeInput

Method takeInput

Java/Array/Sort012.java:51–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

49public class Sort012 {
50
51 public static int [] takeInput() {
52 Scanner sc = new Scanner(System.in);
53 System.out.println("Enter the length of the array: ");
54 int n = sc.nextInt();
55 int [] arr = new int[n];
56
57 for (int i = 0; i < n; i++) {
58 System.out.println("Enter the element at " + i + " th index.");
59 arr[i] = sc.nextInt();
60 }
61 return arr;
62 }
63 public static void swap(int [] arr, int i, int j) {
64 // i = number to be swapped.
65 // j = number with which it is swapped.

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected