Â
In this, we are going to write a program to find the sum of cubes of n integers with the help of C programming language.
#include <stdio.h>
int main()
{
int n, sum;
printf("Enter the value for n:");
scanf("%d", &n);
sum = (n * n) * ((n + 1) * (n + 1)) / 4;
printf("Sum of cubes of first %d natural numbers is %d\n", n, sum);
return 0;
}
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP