Advertisement
kalin729

asdasd

Feb 18th, 2021 (edited)
800
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3.  
  4. void last(int arr[],int n, int p){
  5.     for(int i = 0; i < 23; i++){
  6.         if(arr[i]<p){
  7.             n=i;
  8.         }
  9.     }
  10.     arr[n] = n;
  11.  
  12.     for(int i = 0; i < 23; i++){
  13.         printf("arr[%d] = %d\n",i, arr[i] );
  14.     }
  15.  
  16.     printf("\nposl el index = %d", n);
  17. }
  18.  
  19. int main()
  20. {
  21.  
  22. /*void last(int arr[], int n, int p, int *idx)*/
  23.  
  24.     int p, mas[23], n=0;
  25.     printf("p=");
  26.     scanf("%d", &p);
  27.     for(int i = 0; i < 23; i++){
  28.         printf("mas %d= ", i);
  29.         scanf("%d", &mas[i]);
  30.     }
  31.     last(mas,n,p);
  32.  
  33.  
  34. }
  35.  
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement