+ 1

hi who can coding for this series 1 3 6 10 15 21 28 .....

coding for this series

27th Apr 2017, 4:01 PM
amirshahbazi
6 Respostas
+ 13
My code in c++ https://code.sololearn.com/cMZw7QxXi1Xu/?ref=app Input number of elements to be printed at start
27th Apr 2017, 4:11 PM
Pixie
Pixie - avatar
+ 9
Formula: x * (( 0.5x ) + 0.5 ) Where x is the n'th number, starting at 1. Example: 3 * ((0.5 * 3) + 0.5) = 3 * (1.5+0.5) = 3 * 2 = 6 3rd number is 6.
27th Apr 2017, 4:16 PM
Rrestoring faith
Rrestoring faith - avatar
27th Apr 2017, 4:16 PM
Dinmukhamed Mailibay
Dinmukhamed Mailibay - avatar
+ 4
Since everyone is posting solutions, here is one using a generator: https://code.sololearn.com/ccQuCk15J4bf Nevertheless, you probably should have tried to solve that yourself.
27th Apr 2017, 4:45 PM
Tob
Tob - avatar
+ 3
int outputs = []; const arrSize = 100; for (i=0,a=0;a <arrSize;a++) { i +=a+1; outputs [a] = i: }
27th Apr 2017, 4:11 PM
Calviղ
Calviղ - avatar
+ 2
using C++ #include <iostream> using namespace std; int main() { int a = 0; for (int i = 1; i < 100; i++) { a += i; cout << a << " "; } system("pause"); return 0; } using C# using System; namespace soloApp { class Program { static void Main(string[] args) { int a = 0; for (int i = 1; i < 100; i++) { a += i; Console.Write(a + " "); } } } }
27th Apr 2017, 10:24 PM
Krishneel Nair
Krishneel Nair - avatar