fork download
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5. int size,a[size];
  6.  
  7. printf("Enter the size :");
  8. scanf("%d",&size);
  9.  
  10. printf("Enter the numbers:");
  11.  
  12. for(int i=0;i<size;i++)
  13. {
  14. scanf("%d",&a[i]);
  15.  
  16. }
  17.  
  18. printf("\nThe numbers are :\n");
  19.  
  20. for(int i=0;i<size;i++)
  21. {
  22. printf("%d\t",a[i]);
  23. }
  24.  
  25. int search,k=0;
  26.  
  27. printf("\nEnter the number that you want to search:");
  28. scanf("%d",&search);
  29.  
  30. for(int i=0;i<size;i++)
  31. {
  32. if(a[i]==search)
  33. {
  34. printf("The number %d is found at %dth position",a[i],i+1);
  35. k++;
  36. break;
  37. }
  38. }
  39.  
  40. if(k==0)
  41. {
  42. printf("The number %d is not found:",search);
  43. }
  44. }
Success #stdin #stdout 0s 5308KB
stdin
 
stdout
Enter the size :Enter the numbers:
The numbers are :

Enter the number that you want to search:The number 0 is not found: