Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void mojprog(int a[], int b[], int c[],int n, int m)
- {
- for (int i = 0; i < n; i++)
- {
- a[i] = rand() % 100;
- printf("%d ", a[i]);
- }
- printf("\n");
- for (int i = 0; i < m; i++)
- {
- b[i] = rand() % 100;
- printf("%d ", b[i]);
- }
- printf("\n");
- if (n<m)
- //gdy a jest mniejsze
- {
- for (int i = 0; i < n; i++)
- {
- c[2 * i] = a[i];
- c[1 + 2 * i] = b[i];
- }
- for (int i = n; i < m; i++)
- {
- c[n + i] = b[i];
- }
- }
- //jesli b jest mniejsze
- else
- {
- for (int i = 0; i < m; i++)
- {
- c[2 * i] = b[i];
- c[1 + 2 * i] = a[i];
- }
- for (int i = m; i < n; i++)
- {
- c[m + i] = a[i];
- }
- }
- /*
- for (int i = 0; i < n+m; i=i+2)
- {
- c[i] = a[i];
- c[i+1] = b[i];
- }*/
- }
- void kolos1()
- {
- //int *a;
- //a = (int*)malloc(sizeof(int) * 10);
- int a[10];
- int b[6];
- int c[16];
- mojprog(a, b, c,10,6);
- for (int i = 0; i < 16; i++)
- {
- printf("%d ", c[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement