#include <stdio.h>
void main()
{
int arr[10], Element, i, size, count = 0;
//ask the user for the size of the the array
printf("Enter size of the array:\n");
scanf("%d", &size);
// ask user to provide values of array
printf("Enter any %d integer values:",size);
//save the value in array
for (i = 0; i < size; i++)
{
scanf("%d", &arr[i]);
}
printf("Enter the element to be Search:\n");
scanf("%d", &Element);
for (i = 0; i < size; i++) {
if (arr[i] == Element) {
//print element position
printf("%d is present at location %d.\n", Element, i+1);
//increase count value
count++;
}
}
//if count is 0 after looping all the elements
//then element is not found
if (count == 0)
{
printf("%d isn't present in the array.\n", Element);
}
else
{
printf("%d is present %d times in the array.\n", Element, count);
}
}