Advertisement
Guest User

Untitled

a guest
May 30th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.  
  7. int vet[5], contp, conti, vetp[6]={0}, veti[6]={0}, u, i;
  8. contp = 0;
  9. conti = 0;
  10. u=0;
  11. printf("Digite 6 numeros\n");
  12. for(i=0;i<6;i++)
  13. {
  14. scanf("%d", &vet[i]);
  15. if(vet[i]%2==0)
  16. {
  17. contp=contp + 1;
  18. vetp[u]=vet[i];
  19. u++;
  20. }
  21. else
  22.  
  23. {
  24. veti[u]=vet[i];
  25. conti=conti + 1;
  26. u++;
  27. }
  28. }
  29. if(contp>0)
  30. {
  31. printf("OS NUMEROS PARES SAO: ");
  32. for(i=0;i<contp;i++)
  33. printf("%d\n", vetp[i]);
  34. }
  35. else
  36. {
  37. printf("NAO HOUVE NUMEROS PARES\n");
  38. }
  39. printf("O NUMERO DE NUMEROS PARES E: %d\n", contp);
  40. if(conti<=0)
  41. printf("NAO HOUVE NUMEROS IMPARES\n");
  42. else{
  43. printf("OS NUMEROS IMPARES SAO: ");
  44. for(i=0;i<conti;i++)
  45. printf("%d\n", veti[i]);
  46. }
  47. printf("O NUMERO DE NUMEROS IMPARES E: %d\n", conti);
  48. return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement