• Question
  • How do I make something that takes a percentage out of something?

person ok yeah but that apparently returns the remainder of a division problem

var y = prompt("divisor");
var x = prompt("dividend");
var outcome = y % x;
textSize(24);
text("when dividing " + (x + (" by " + y)), 100, 170);
text("the outcome is" + outcome, 100, 200);

idk seems to work for me

oh yeah what i meant is that- lemme just show you

var percentCalc = 100*1/cost; //turns out, it's just you're average whole number
var cost = 100;

if (bla bla bla) {
  cost  -= percentCalc //which arises here when the actual thing isnt a percent, instead a whole number
}

    oh i see in that case get a calculator or something

      pluto
      wouldnt it just be
      var onePercent = (totalCost/100);
      tenPercent = onePercent*10;

      Letti42 or if you want it to be a specific percentage each time, it'd be:

      var number = 100;
      var percent = 10; //in percent, so this would be 10%
      var newNumber = number * (percent/100)

        Letti42 that's what i was just talking about, its kinda of a whole number and not an actual percentage

        Chat