We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 84e9378 commit 983ad4dCopy full SHA for 983ad4d
maths/series/sum of sqaures of n natural numbers
@@ -0,0 +1,15 @@
1
+#find sum of n natural numbers
2
+class sum_of_squares:
3
+ def get_square_of_series(self,n):
4
+ self.n=n
5
+ if n>0:
6
+ r=(n*(n+1)*((2*n)+1))/6
7
+ print(f"The sum of squares of the first {n} natural numbers is {r}")
8
+ else:
9
+ print("Kindly enter a natural number!")
10
+
11
12
13
+solution1=sum_of_squares()
14
+a=int(input("Enter a natural number to find sum of sqaures upto that number:"))
15
+solution1.get_square_of_series(a)
0 commit comments