C++ PROGRAM MATH FOR MECHANICAL

6. 12 + 22 + . . . . .+ n2 = ?
#include <stdio.h>
main()
{
  int n, count;
  float x, sum;
  printf("The value of n is ");
  scanf("%d", &n);
  sum = 0.0;
  count = 1;
  do
    {
      sum = sum + count*count;
      count = count + 1;
    }
  while(count <= n);
    printf(" \n\nThe sum of the series = %f", sum);
return 0;
}

Comments

Popular posts from this blog

Industrial Attachment

লেনজ এর সুত্র