# ** is **% of what number in javascript

posted Sep 26

In lower classes , we have that chapter of percentage in mathematics. Wee  used to love that chapter because that one was easy. This article discusses one of them in both word and code format. Don’t worry if you don;t know about percentages.

# Word solution

The question looks like this. ** is **% of what number?
We can use any number for the given question, but for explanation I am taking 78 as 15% of any number. So the question will become something like that. 78 is 15% of what number?
Now we have to find a number for which the 15% is 78. Let that number be X. Mathematical equation for that  will be

When we multiply by 100/15 on both  sides we will get our answer. Which in  this case is 520.
Now, we will create a simple function in our program  for doing that.

## Program

``````<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<body>
<script>
var num = 47;
var perc = 15;
var actual;
actual  =  (num*100)/perc;
console.log(actual);
</script>
</body>
</html>
``````

Here, we created three variables num which is value (in previous example it was 78), perc which is the percentage and actual value (in previous example  it was 520). After that we used the same  previous calculations for finding the actual value.

Hope this will help.

100 points
7 4