- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C Program for the cube sum of first n natural numbers?
The cube sum of first n natural numbers is the program to add cubes of all natural numbers up to n. It is sum of series 1^3 + 2^3 + …. + n^3 that is sum of cube of n natural numbers.
Input:6 Output:441
Explanation
1^3 + 2^3 + 3^3 + 4^3 + 5^3 + 63 = 441
Using For loop to increase the no. and cubing it and taking sum of them.
Example
#include <iostream> using namespace std; int main() { int n = 6; int sum = 0; for (int i = 1; i <= n; i++) { sum += i * i * i; } printf(“%d”, sum); return 0; }
- Related Articles
- C++ Program for cube sum of first n natural numbers?
- C Program for cube sum of first n natural numbers?
- Program for cube sum of first n natural numbers in C++
- Python Program for cube sum of first n natural numbers
- Java Program to cube sum of first n natural numbers
- Swift Program to Calculate Cube Sum of First n Natural Numbers
- C++ Program for Sum of squares of first n natural numbers?
- Sum of first n natural numbers in C Program
- Python Program for Sum of squares of first n natural numbers
- Sum of squares of first n natural numbers in C Program?
- Program to find sum of first n natural numbers in C++
- Sum of sum of first n natural numbers in C++
- 8085 program to find the sum of first n natural numbers
- Find the sum of first $n$ odd natural numbers.
- PHP program to calculate the sum of square of first n natural numbers

Advertisements