diff --git a/index.html b/index.html new file mode 100644 index 0000000..c66dd77 --- /dev/null +++ b/index.html @@ -0,0 +1,13 @@ + + + + + + + Document + + + + + + \ No newline at end of file diff --git a/zadanie_4.js b/zadanie_4.js new file mode 100644 index 0000000..04ee926 --- /dev/null +++ b/zadanie_4.js @@ -0,0 +1,44 @@ +"use strict" +let balans = Number (prompt( 'Введите сумму, которой располагаете')); +const pricePhon = 15; //стоимость телефона +const acsessoriesP = 5; // стоимость аксессуаров +const nalog = pricePhon*20/100; // налог +let sum = pricePhon + acsessoriesP + nalog; // стоимость комплекта телефон+аксессуар +let sumPhNal = pricePhon + nalog; // цена телефона с налогом +let acsnal = acsessoriesP + (acsessoriesP*20/100); // аксессуары с налогом +let phoneP = 0; +let accesoriesPr = 0; +let phoneN = 0; +let accesoriesN = 0; + +while (balans > sum ){ +if (balans >=sum ) { + balans = balans - sum; + phoneN += sumPhNal; + accesoriesN += acsnal; + phoneP++; + accesoriesPr++; + +} +else{ + if(balans >= acsnal && balans <= sumPhNal) { + balans -= acsnal; + accesoriesN +=acsnal; + accesoriesN++ + } + else{ + break; + } + } + + } + + alert("Вы можете купить телефонов:" + phoneP); + alert("Вы можете купить аксессуаров:" + accesoriesPr); + + if (balans