Sum Of Squares Of "n" Integers

In this, we are going to write a program to find the sum of squares of n integers with the help of C programming language.

#include <stdio.h>
#include <math.h>

void main()
{
    int n, sum;
    printf("Input the number of terms : ");
    scanf("%d", &n);
    sum=n*(n + 1)*(2 * n + 1)/6;
    printf("The sum of square of natural numbers upto %d are = %d",n,sum);
}

#ENJOY CODING

Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post