title: Sum of prime factors
body: <p>I am trying to show the sum of the prime factors of a given number and
  I'm having difficulties displaying the prime factors in my output.</p>
  
  <p>Sample Output:</p>
  
  <pre><code>Input number: 6
  Factors are: 1 2 3
  Sum of its factor: 1 +2 +3 =6
  </code></pre>
  
  <p>I am able to show the sum but I want to show the <code>1+2+3=6</code> like in the sample above where the factors are <code>1 2 3</code>.</p>
  
  <p>Can you help me correct my syntax to achieve this? Thanks in advance.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main() {
      int i, j, num, isPrime, sum;
  
      printf("Input number: ");
      scanf("%d", &amp;num);
  
      printf("Factors are: ", num);
  
      for (i = 1; i &lt;= num; i++) {
          if (num % i == 0) {
              isPrime = 1;
              for (j = 2; j &lt;= i / 2; j++) {
                  if (i % j == 0) {
                      isPrime = 0;
                      break;
                  }
              }
  
              if (isPrime == 1) {
                  printf("%d ", i);
                  sum += i;
              }
          }
      }
  
      printf("\nSum of its factor : %d", sum);
      return 0;
  }
  </code></pre>