Advertisement
Kl43z

Certamen 1 Ejercicio 1

Nov 18th, 2014
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.74 KB | None | 0 0
  1. #include <stdio.h>
  2.     #define ARRA 6
  3.     #define ARRB 6
  4.    
  5.  
  6. int main(){
  7.     int i=0,n=0,min,max;
  8.     int arregloA[ARRA], arregloB[ARRB]={0};
  9.     printf ("Asegúrese de ingresar los numéros de mayor a menor:\n");
  10.     do{
  11.         printf ("Ingrese el %d° número:", i+1 );
  12.         scanf ("%d", &arregloA[i]);
  13.         if (i==0) i++;
  14.         else if (arregloA[i]< arregloA[i-1]) i++;      
  15.         else continue;
  16.     }while (i<ARRA);
  17.        
  18.     for (i=0;i<ARRA;){
  19.         if (arregloA[i]%2==0){
  20.             arregloB[n]=arregloA[i];
  21.             i++;
  22.             n++;
  23.         }
  24.         else i++;
  25.     }
  26.    
  27.     for (i=0;i<ARRA;){
  28.         if (arregloA[i]%2!=0){
  29.             arregloB[n]=arregloA[i];
  30.             i++;
  31.             n++;
  32.         }
  33.         else i++;
  34.     }
  35.    
  36.     for (i=0;i<ARRB;i++){ //Mostrar Arreglo por pantalla.
  37.         printf ("%d ", arregloB[i]);
  38.     }
  39.     printf ("\n");
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement