JHJiban

AL 03

Dec 7th, 2020
592
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.55 KB | None | 0 0
  1. //Jiban
  2. //192-15-13117
  3. #include <stdio.h>
  4. int main()
  5. {
  6.   int array[100], search, c, n;
  7.  
  8.   printf("Enter Digit Number: ");
  9.   scanf("%d", &n);
  10.  
  11.   printf("Enter %d of Your ID: ", n);
  12.  
  13.   for (c = 0; c < n; c++)
  14.     scanf("%d", &array[c]);
  15.  
  16.   printf("Enter a digit to search: ");
  17.   scanf("%d", &search);
  18.  
  19.   for (c = 0; c < n; c++)
  20.   {
  21.     if (array[c] == search)
  22.     {
  23.       printf("%d is present at location %d.\n", search, c+1);
  24.       break;
  25.     }
  26.   }
  27.   if (c == n)
  28.     printf("%d isn't present in the array.\n", search);
  29.  
  30.   return 0;
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment