Advertisement
Guest User

Untitled

a guest
Apr 5th, 2020
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.67 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int array[100], maximum, size, c, location = 1,idx;
  4. int main()
  5. {
  6.  
  7.   scanf("%d", &size);
  8.  
  9.   for (c = 0; c < size; c++)
  10.     scanf("%d", &array[c]);
  11.  
  12. idx = max(array,size);
  13. deleteitem(array,size,idx);
  14.  
  15.     for (c = 0; c < size; c++)
  16.         printf("%d\n", array[c]);
  17.   return 0;
  18. }
  19.  
  20. int max(int array[] , int n)
  21. {
  22.     maximum = array[0];
  23.  
  24.   for (c = 1; c < n; c++)
  25.   {
  26.     printf(array[c]);
  27.     if (array[c] > maximum)
  28.     {
  29.        maximum  = array[c];
  30.        location = c+1;
  31.     }
  32.   }
  33.  return location;
  34. }
  35. int deleteitem(int array[] , int n , int index )
  36. {
  37.     for (c = index - 1; c < n - 1; c++)
  38.          array[c] = array[c+1];
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement