• Now Online : 66
  • admin@codemyne.net

Introduction

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

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

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

Comments Post a Comment