Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define N 500
- void array();
- int main(){
- int a[N], b[N], c[N];
- array(a,b,c);
- }
- void array(int a[N], int b[N], int c[N]){
- int x[3*N], cero = 0, count = 0;
- for (int i = 0; i < N; i++){
- a[i] = rand() % 2001;
- b[i] = rand() % 2001;
- c[i] = rand() % 2001;
- }
- for (int i = 0; i < N; i++){
- x[i] = a[i];
- x[i+N] = b[i];
- x[i + 2*N] = c[i];
- }
- for (int i = 1; i < 3*N; i++){
- for (int j = 0; j < 3*N -1; j++){
- if (x[j] > x[j+1]){
- cero = x[j];
- x[j] = x[j+1];
- x[j+1] = cero;
- }
- }
- }
- for (int i = 0; i < 3*N; i++){
- printf("%d\n",x[i]);
- count = 1 + i;
- }
- printf("En total hay %d numeros",count);
- }
Advertisement
Add Comment
Please, Sign In to add comment