Question: I am not able to meet all the conditions of prime factors of a number so that I find the correct sum. 

```
    int sumPrime(number){

         int counter;
         int sum=0;
         for(counter=2;counter<=(number/2);counter++){
           if(number%counter==0){
              sum=counter;
              counter++;
              sum+=counter;

              }
           return sum;  

          }
    }

```

Answer: 
I think the code is self explanatory. It works for `number >= 2`.

```
int sumPrime(int number){
     int factor = 2;
     int sum=0;

    while(1 != number){ //Repeat the loop till number becomes 1.
       if(number%factor==0){ //Check if factor divides the number.
          number /= factor; //If yes, update the number.
          sum+=factor; //Add factor to sum.
          printf("Factor [%d]\n", factor);
          continue;
        }
        factor++; //If the current number is not a factor, check the next number.
    }
    printf("Sum [%d]\n", sum);
    return sum;
}

```

Output for 12:

```
Factor [2]                                                                                                                                      
Factor [2]                                                                                                                                      
Factor [3]                                                                                                                                      
Sum [7] 

```
```
#include <stdio.h>

int main(){

    printf("sum is%i",sumCount(12));
    return 0;
}
int sumCount(int number){
int count,sum=0;
for(count=2;count<number;count++){
    if(isPrime(count)==1){
        printf("%i \n",count);
        sum+=count;
    }
}
return sum;
}
int isPrime(int number){
    int i;
    for (i=2;i<=number/2 ;i++){
        if(number%i==0){
        return 0;
    }
}
return 1;
}

```