<?php
$parcelas=11;
$segredo = (1 + $parcelas) * (($parcelas) / 2);
$valor="R$ 1900,30";
for ($x = 1; $x <= ($parcelas-1); $x++) {
$parcela = intval((($preco*$x)/$segredo)); $somatorio=$somatorio+$parcela;
}
$ultima=$preco-$somatorio;
echo ("R$ ".($ultima.$decimal));
PD9waHAKCgkkcGFyY2VsYXM9MTE7CgoJJHNlZ3JlZG8gPSAoMSArICRwYXJjZWxhcykgKiAoKCRwYXJjZWxhcykgLyAyKTsKCgkkdmFsb3I9IlIkIDE5MDAsMzAiOwoKICAgICAgICAkcHJlY289dHJpbShzdHJfcmVwbGFjZSgiUiQiLCIiLCR2YWxvcikpOwogICAgICAgICRkZWNpbWFsPSBzdWJzdHIoJHByZWNvLChzdHJsZW4oJHByZWNvKS0zKSxzdHJsZW4oJHByZWNvKSk7CiAgICAgICAgJHByZWNvPShzdHJfcmVwbGFjZSgkZGVjaW1hbCwiIiwkcHJlY28pKTsKICAgICAgICAKICAgICAgICBmb3IgKCR4ID0gMTsgJHggPD0gKCRwYXJjZWxhcy0xKTsgJHgrKykgewogICAgICAgICAgICRwYXJjZWxhID0gaW50dmFsKCgoJHByZWNvKiR4KS8kc2VncmVkbykpOwogICAgICAgICAgIGVjaG8gKCJSJCAiLiBudW1iZXJfZm9ybWF0KCRwYXJjZWxhLCAyLCAnLCcsICcuJykpLiJcbiI7CiAgICAgICAgICAgJHNvbWF0b3Jpbz0kc29tYXRvcmlvKyRwYXJjZWxhOwoJCX0KCQkkdWx0aW1hPSRwcmVjby0kc29tYXRvcmlvOwogICAgICAgIGVjaG8gKCJSJCAiLigkdWx0aW1hLiRkZWNpbWFsKSk7
R$ 28,00
R$ 57,00
R$ 86,00
R$ 115,00
R$ 143,00
R$ 172,00
R$ 201,00
R$ 230,00
R$ 259,00
R$ 287,00
R$ 322,30
PHP Notice: Undefined variable: somatorio in /home/VylIst/prog.php on line 16