├── README.md ├── cpp └── main.cpp └── js └── main.js /README.md: -------------------------------------------------------------------------------- 1 | # arithmetic-progression 2 | arithmetic-progression with js, cpp 3 | -------------------------------------------------------------------------------- /cpp/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | double x,y,i; 8 | cin>>x>>y; 9 | i=(x+y)/2; 10 | cout< { 7 | let LENGTH = 0; 8 | let _LOOP = 0; 9 | let _EQUAL = 1; 10 | const msg = ["Please enter a input", "system error", "this is dummie number"]; 11 | let structure = [firstInput.value, secondInput.value]; 12 | if (!structure[LENGTH] && !structure[_EQUAL]) { 13 | structure.map((i) => { 14 | if (i != "") { 15 | console.log("structure is working"); 16 | } 17 | }); 18 | while (_LOOP <= structure[LENGTH]) { 19 | for (let _i = _LOOP; _i <= structure[LENGTH]; _i++) { 20 | if (_LOOP == structure[LENGTH]) { 21 | let _k = _LOOP + _EQUAL; 22 | alert(msg[(LENGTH = _k - _EQUAL)]); 23 | } 24 | } 25 | _LOOP++; 26 | } 27 | } else { 28 | if (!structure[_EQUAL]) { 29 | alert(msg[LENGTH]); 30 | } else { 31 | if (_LOOP != LENGTH && LENGTH != LENGTH) { 32 | console.log(msg[_EQUAL]); 33 | } else { 34 | if (structure[LENGTH] <= LENGTH || structure[_EQUAL] <= LENGTH) { 35 | if (msg[2]) alert(msg[2]); 36 | } else { 37 | let _LENGTH_INPUT = 2; 38 | let _l = (+structure[LENGTH] + +structure[_EQUAL]) / _LENGTH_INPUT; 39 | paragraph.innerHTML = _l; 40 | console.log(_l); 41 | } 42 | } 43 | } 44 | } 45 | }); 46 | --------------------------------------------------------------------------------