• Now Online : 30
  • admin@codemyne.net

Introduction

The program shows the sum of squares of n numbers. By using the formula (n*(n+1)*((2*n)+1))/6 sum of squares of numbers can be calculated. 1^2+2^2+3^2....

#include<stdio.h>
#include<conio.h>
        void main()
        {
            int a,n;
            clrscr();
            printf("/n Enter a number:");
            scanf("%d",&n);
            a=(n*(n+1)*((2*n)+1))/6;
            printf("sum of squares of numbers upto %d is %d",n,a);
            getch();
        }

Comments/Suggestions are invited. Happy coding......!

Comments Post a Comment