Examples of C part 65 sum of series 1^2..........

PROGRAM :
#include <stdio.h>
#include<math.h>
main()
{
 //1^2+2^2+3^2+......n^2
  int i,num,sum=0;
  printf("Enter number \n");
  scanf("%d",&num);
  for(i=1;i<=num;i++)
  {
   sum+=pow(i,2);
  }
  printf("Sum of series\n");
  for(i=1;i<=num;i++)
  {
   if(i!=num)
   {
      printf("%d^2+ ",i);
    }
    else
    {
     printf("%d^2 = %d\n",i,sum);
    }

  }
}
Output:
Enter number
25
Sum of series
1^2+ 2^2+ 3^2+ 4^2+ 5^2+ 6^2+ 7^2+ 8^2+ 9^2+ 10^2+ 11^2+ 12^2+ 13^2+ 14^2+ 15^2+ 16^2+ 17^2+ 18^2+ 19^2+ 20^2+ 21^2+ 22^2+ 23^2+ 24^2+ 25^2 = 5525
Explanation:
//Coming Soon