Advertisement
JCLC

Untitled

May 4th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.77 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. //Createad by Jefferson Carlos
  4. //Graduando em Eng. da Computação - 2016.1 - UFPE
  5.  
  6. int main(){
  7.     int pares[5] = { 0 }, impares[5] = { 0 }, z = 0, y = 0,  x[15] = { 0 }, count = 0, l = 0;
  8.  
  9.         for(z = 0; z < 15; z++){
  10.             scanf("%d", &x[z]);
  11.         }
  12.  
  13.         for(z = 0; z < 15; z++){
  14.             if(x[z]%2 == 0){
  15.                 for(l = count; l < 6; l++){
  16.                 pares[l] = x[z];
  17.                 }
  18.                 count++;
  19.             }
  20.             if(count == 5){
  21.             for(y = 0; y < 5; y++)
  22.                printf("par[%d] = %d\n", y+1, pares[y]);
  23.             }
  24.         }
  25.  
  26.         for(z = 0; z < 15; z++){
  27.             if(x[z]%2 != 0){
  28.                 for(l = count; l < 6; l++){
  29.                 impares[l] = x[z];
  30.                 }
  31.                 count++;
  32.             }
  33.             if(count == 5){
  34.             for(y= 0; y < 5; y++)
  35.                printf("impares[%d] = %d\n", y+1, impares[y]);
  36.             }
  37.         }
  38.  
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement