Advertisement
Kl43z

Guia ArreglosU - 1

Nov 18th, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.57 KB | None | 0 0
  1. #include <stdio.h>
  2.     #define SIZE 21
  3.  
  4. int main(){
  5.     int par[SIZE]={0}, impar[SIZE]={0},i=0,aux,n=0,cant=0,tam=0,tam2=0;
  6.  
  7.     do{
  8.         printf ("Ingrese un número para la casilla [%d]: ", cant+1);
  9.         scanf ("%d", &aux);
  10.         if (aux%2==0){
  11.             par[i]=aux;
  12.             i++;
  13.             cant++;
  14.             tam++;
  15.         }
  16.         else{
  17.             impar[n]=aux;
  18.             n++;
  19.             cant++;
  20.             tam2++;
  21.         }
  22.     }while (cant<SIZE);
  23.     printf("Arreglo PAR:\n");
  24.     for (i=0;i<tam;i++){
  25.         printf ("[%d] ", par[i]);
  26.     }
  27.     printf ("\nArreglo IMPAR:\n");
  28.     for (i=0;i<tam2;i++){
  29.         printf ("[%d] ", impar[i]);
  30.     }  
  31.     printf ("\n");
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement