fork download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int arr[5];
  6. int i;
  7. int element;
  8. //printf("enter the elements of array");
  9. for(i=0;i<5;i++)
  10. {
  11. scanf("%d \t",&arr[i]);
  12. }
  13. // printf("Enter the element for which you want the search the respective index");
  14. scanf("%d",&element);
  15. for(i=0;i<5;i++)
  16. {
  17. if(arr[i] == element)
  18. printf("Location of this element is %d",i);
  19.  
  20.  
  21.  
  22. }
  23.  
  24.  
  25.  
  26. return 0;
  27. }
Success #stdin #stdout 0s 2252KB
stdin
10
30
35
45
67

67
stdout
Location of this element is 4