Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Definition forming
Definition forming
# include & ltstdio.h & gt

Int Find(int a[], int n, int e)// Find the subscript of the integer e in an integer array a with any n elements.

{

for(int I = 0; I & ltn;; i++)

If(a[i]==e) returns I; //Find an integer and return its subscript.

return- 1; //Not found, return failure flag.

}

int main()

{

Int is a [10];

for(I = 0; I< 10; i++) scanf("%d ",& ampa[I]);

Printf ("Please enter an integer to find:");

scanf("%d ",& ampe);

i=Find(a, 10,e);

If (me! =- 1) printf ("The subscript of this integer is %d\n", i);

Else printf ("Integer not in array \ n");

Returns 0;

}