
- C++ Basics
- C++ Home
- C++ Overview
- C++ Environment Setup
- C++ Basic Syntax
- C++ Comments
- C++ Data Types
- C++ Variable Types
- C++ Variable Scope
- C++ Constants/Literals
- C++ Modifier Types
- C++ Storage Classes
- C++ Operators
- C++ Loop Types
- C++ Decision Making
- C++ Functions
- C++ Numbers
- C++ Arrays
- C++ Strings
- C++ Pointers
- C++ References
- C++ Date & Time
- C++ Basic Input/Output
- C++ Data Structures
- C++ Object Oriented
- C++ Classes & Objects
- C++ Inheritance
- C++ Overloading
- C++ Polymorphism
- C++ Abstraction
- C++ Encapsulation
- C++ Interfaces
C++ Program for cube sum of first n natural numbers?
Positive integers 1, 2, 3, 4... are known as natural numbers.
This program takes a positive integer from the user ( suppose user-entered n ) then, this program displays the value of 13+23+33+....+n3.
Input: n = 3 Output: 36
Explanation
13+23+33 = 1 +8+27 = 36
This program takes a positive integer from user( suppose user entered n ) then, this program displays the value of 13+23+33+....+n3.
Example
#include <iostream> using namespace std; int main() { int n = 3; int sum = 0; for (int x=1; x<=n; x++) sum += x*x*x; cout << sum; return 0; }
- Related Articles
- Python Program for cube sum of first n natural numbers
- C Program for cube sum of first n natural numbers?
- C Program for the cube sum of first n natural numbers?
- Program for cube sum of first n natural numbers in C++
- Java Program to cube sum of first n natural numbers
- Swift Program to Calculate Cube Sum of First n Natural Numbers
- Python Program for Sum of squares 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
- Java Program to Display Numbers and Sum of First N Natural Numbers
- Sum of squares of first n natural numbers in C Program?
- 8085 program to find the sum of first n natural numbers
- Program to find sum of first n natural numbers in C++
- Sum of sum of first n natural numbers in C++
- Java Program to calculate Sum of squares of first n natural numbers

Advertisements