Print the sum of cubes of n natural numbers. Python

Posted on | Sunday, 14 May 2023 | No Comments

 Given a positive integer N, print the sum of cubes of 1st N natural numbers.

Input Format

First and only line of input contains a positive integer - N.

Constraints

1 <= N <= 102

Output Format

Print the sum of cubes of 1st N natural numbers.

Sample Input 0

4

Sample Output 0

100
code
n=int(input())
p=n**2
print(int(((p+n)/2)**2))

Comments

Leave a Reply

Search

Followers