anhkiet2507

ChenMang1

May 1st, 2021 (edited)
1,768
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. const int MAX = 100;
  4. const int MAX2 = 200;
  5. int m,n;
  6. void Chen(int a[], int b[], int k){
  7.     int x = 0;
  8.     int y = 0;
  9.     int c[MAX2];
  10.     for (x = 0; x < k ; x++){
  11.         c[y] = a[x];
  12.         y++;
  13.     }
  14.     for (x = 0; x < n; x++){
  15.         c[y++] = b[x];
  16.     }
  17.     for (x = k; x < m; x++){
  18.         c[y++] = a[x];
  19.     }
  20.     for (x = 0; x < (m+n); x++){
  21.         printf("%d ", c[x]);
  22.     }
  23. }
  24.  
  25. int main(){
  26.     int i,j,vitri;
  27.     int a[MAX];
  28.     int b[MAX];
  29.     scanf("%d%d", &m, &n);
  30.     for (i = 0; i < m ; i++){
  31.         scanf("%d", &a[i]);
  32.     }
  33.     for (j = 0; j < n ; j++){
  34.         scanf("%d", &b[j]);
  35.     }
  36.     scanf("%d", &vitri);
  37.     Chen(a,b,vitri);
  38.     return 0;
  39. }
Add Comment
Please, Sign In to add comment