import java.util.Scanner;
class LinearSearch
{
public static void main(String args[])
{
int c, n, search, array[];
Scanner in = new Scanner(System.in);
System.out.println("Enter number of elements");
n = in.nextInt();
array = new int[n];
System.out.println("Enter " + n + " integers");
for (c = 0; c < n; c++)
array[c] = in.nextInt();
System.out.println("Enter value to find");
search = in.nextInt();
for (c = 0; c < n; c++)
{
if (array[c] == search) /* Searching element is present */
{
System.out.println(search + " is present at location " + (c + 1) + ".");
break;
}
}
if (c == n) /* Element to search isn't present */
System.out.println(search + " isn't present in array.");
}
}
NEED VDT OF THIS PROGRAM
Answers
Answered by
0
Answer:
what you are not able to understand dear answer
.................................. please mark as brainlist
Similar questions
English,
3 months ago
Chinese,
3 months ago
Social Sciences,
6 months ago
Math,
6 months ago
World Languages,
11 months ago
Science,
11 months ago
Science,
11 months ago