Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int i,j,k,y,v[10],soma,quantidade=0,count=0,aux;
- for(i=0; i <=2; i++){
- printf("\n Digite um num: ");
- scanf("%d",&v[i]);
- if(v[i] %2 ==0)
- {
- quantidade++;
- }else if(!v[i] %2 == 0)
- {
- count++;
- }
- }
- if(quantidade >0)
- {
- for(y=0; y <= quantidade; y++){
- if(v[y] %2 == 0)
- {
- soma = soma+v[y];
- }
- }
- printf("A Soma dos Pares \n",soma);
- }
- if (count >0)
- {
- for(y=0; y <= count; y++){
- if(!v[y] %2 ==0)
- {
- soma = soma+v[y];
- }
- }
- printf("A soma dos impares -> %d\n",soma);
- }
- printf("\n Quantidade De Pares [%d] \n Quantidade de Impares [%d] \n",quantidade,count);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement