#include <stdio.h>
#define NUMBER 7
int search(const int v[], int idx[], int key, int n)
{
int i = 0, j = 0;
while (i < n)
{
if (v[i] == key)
{
idx[j] = i;
j++;
}
i++;
}
printf("{");
for (i = 0; i < j; i++)
{
printf("%d ", idx[i]);
}
printf("}\n");
printf("the number is %d\n", j);
}
int main(void)
{
int i, nu, a[NUMBER], b[NUMBER];
puts("please input the elements.");
for (i = 0; i < NUMBER; i++)
{
printf("a[%d] = ", i); scanf("%d", &a[i]);
}
printf("nu = "); scanf("%d", &nu);
search(a, b, nu, NUMBER );
return 0;
}