+ 5
Write a program to print the sum of 'n' odd numbers ,starting from 1.
Suppose , n=4 It should print it in the following format: 1+3+5+7=16
15 Answers
+ 18
mine is bit different đ
+ 14
here , cpp & python are more famous than java
+ 12
my try (in java) âș
https://code.sololearn.com/cKtb2G34KoI3/?ref=app
+ 8
try mine in Python đ
https://code.sololearn.com/cHnUV0gPBLBb/?ref=app
+ 6
https://code.sololearn.com/c873an9V3v42/?ref=app
+ 4
@Gaurav
Here's another one in java...
https://code.sololearn.com/cWDT6Ch3Yma5/?ref=app
+ 3
https://code.sololearn.com/cILb6yyHl7GH/?ref=app
+ 2
Ahh, I missed the "C++, Java, and C" tags... but for what it's worth, here's a (cramped) one-liner in Ruby:
https://code.sololearn.com/c2g65DCs0327/?ref=app
Well done to those completing the challenge in the intended languages
+ 2
Here's my try, it can work upto input of 1000, then you have to increase range which can be done by adding one more zero in the fifth line, it's a customizable code.
https://code.sololearn.com/c4cNrHCoItQz/?ref=app
+ 1
https://code.sololearn.com/cH4UPYe74u2k/?ref=app
0
Check out mine in C++ !!
https://code.sololearn.com/cUTiL4g9B5lx/#cpp