Header Ads Widget

Program to find the Cube of elements up to a given Number in python

Program to find the Cube of elements up to a given Number in python:-


Code:-
         

def cube(n):
cubes={}
for i in range(1,n+1):
cubes[i]=i**3
return cubes
x=int(input("Enter the number : "))
print(cube(x))

 
Output:-

Enter the number : 4
{1: 1, 2: 8, 3: 27, 4: 64}



Recommended Post:-

codechef problems:-

Wipro :-

Infytq :-

Key Points;-

Hackerrank:-


C-tutorial:-

See more:-
















Post a Comment

0 Comments