我该如何计算百分比 [英] How do I calculate percentage

查看:119
本文介绍了我该如何计算百分比的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何根据提供的具有相应值的任何主题数量来计算百分比。我有一个带有七个文本字段的表单,其标签为subject1,subject2 .... 7.我希望它计算出与其值一起填充的主题数量的百分比。如果我能看到任何可以使用Dreamweaver工作的脚本,我将不胜感激。

how do I calculate percentage based on any number of subject offered with respective values. I have a form with seven textfields with the label subject1,subject2.... 7. I want it to calculate it's percentage bade on the number of subjects filled along with its values. I will be grateful if I can see any script that can work using dreamweaver.

推荐答案

计算百分比的算法就像这个,



The algorithm to calculate the percentage would be like this one,

(obtained marks / total marks) * 100





。在你的情况下,获得的标记将来自7个文本框的值的总和,总标记将更像700或取决于课程。乘以100得到百分比。您可以在PHP中编写整个过程来捕获所有textBox的值,并将它们添加到变量中。然后运行上面的表达式,它将解析为包含百分比的值。



.. in your case, obtained marks will come from the sum of the 7 textBoxes' values, and the total marks would be more like 700 or depends on the courses. Multiply by 100 to get the percentage. You can write the whole process in PHP to capture the values for all of the textBoxes, and add them up in a variable. Then run the above expression, it will resolve to a value that will contain the percentage.


这篇关于我该如何计算百分比的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆