title: write program to perform sum = 1+ (1+2) + (1+2+3) + ... + (1+2...+n)
body: <p>I can't get the codes right.
  Can somebody help?</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  int main()
  {
   int n, sum,i,j;
  
   printf("Please enter an integer, n = ");
   scanf("%d", &amp;n);
  
   for(i=1;i&lt;=n;i++)
       for(j=1;j&lt;=i;j++)
           sum = sum + n;
   printf("sum = %d", sum);
  
  
   return 0;
  }
  </code></pre>