+ 13
Challenge (-2)
Make a program which can find the sum of first n natural of numbers by using n² method and can find all the n number which is taken as input are odd or not....
13 Réponses
+ 13
+ 14
Do you mean
1+2+3+...+n
or
Find odd numbers in the given inputs
or
both?
+ 14
do you mean "completing the square method"?
+ 8
@krishna Yes !
(Sorry for late reply I was studying ^_^ )
+ 8
@aziz please post your code in Playground then post the link here ^_^
@Nomeh what do you mean ? 😸
+ 7
do you mean use the rule n * (n + 1)/2
+ 7
def sum(n):
return n*(n+1)/2
+ 6
here's my java try.....
https://code.sololearn.com/c36s2E2s1a7w/?ref=app
+ 6
Here is the code:
https://code.sololearn.com/cj1Gih6Ne55b/?ref=app
+ 5
Can u do it
+ 2
I don't understand the question
0
@archana in term of complexity your code is the best one