fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int arr[] = {3, 5, 6, 8, 9, 12, 14, 15, 19, 26, 28, 30, 35};
  5. int n = sizeof(arr) / sizeof(arr[0]);
  6. int target, i;
  7.  
  8. printf("Enter the Target Element: ");
  9. scanf("%d", &target);
  10.  
  11. for(i = 0; i < n; i++) {
  12. if(arr[i] == target) {
  13. printf("Element found at position %d\n", i + 1);
  14. return 0;
  15. }
  16. }
  17.  
  18. printf("Element not found\n");
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
Enter the Target Element: Element not found