write the logic to count repeated even elements

–1 vote
asked Aug 28, 2019 by guru

1 Answer

0 votes
answered Sep 13, 2019 by Jongbo (460 points)
#include <stdio.h>

void main()
{
    int count=0;
    int i;
    int nums[10];
    for(i=0;i<10;i++){
        scanf("%d",&nums[i]);
    }
    for(i=0;i<10;i++){
        if((nums[i]%2)!=1){
            int sNum = nums[i];
            for(int j=i;j>0;j--){
                if(nums[i]==nums[j]){
                    
                    count = count+1;
                    break;
                }
            }
        }
    }
    if(count!=0){
     printf("%d",count+1);   
    }
    else{
        printf("%d",count);   
    }
    
    
}

sorry this isnt fully right. I wanted to fix it but I had to go, but this might give you hint, so if you can manipulate it, it will help you
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...