Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
manual input array find value
#include <stdio.h>
int main()
{
int arr_size, arr_input, find;
printf("\n Please size of the array : ");
scanf("%d", &arr_size);
int arr[arr_size] = {};
for (int i = 0; i < arr_size; i++) {
printf("\n Please enter array value index %d : ", i);
scanf("%d", &arr_input);
arr[i] = arr_input;
}
printf("\n\n Please Enter Number of elements in an array : ");
scanf("%d", &find);
int total = 0;
for(int i = 0; i < arr_size; i++)
{
if (arr[i] == find) {
total++;
}
}
printf ("\n\nTotal array %d is %d \n", find, total);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.