|
 |
asp_web_howto thread: Re: How to create a percentage using ASP?
Message #1 by kyle.b.willman@u... on Fri, 28 Jun 2002 11:08:19 -0500
|
|
Just calculate the percentage like:
percentage = 100*(answerright/total)
Kyle B. Willman
PricewaterhouseCoopers LLP
Office: xxx.xxx.xxxx
Cell: xxx.xxx.xxxx
"Jeff McFarland"
<jeff@s...> To: "ASP Web HowTo" <asp_web_howto@p...>
06/28/2002 11:27 cc:
AM Subject: [asp_web_howto] How to create a percentage using ASP?
Please respond to
"ASP Web HowTo"
Hi,
I am creating a math placement form. Once the user fills out the form,
the answers are tabulated and compared to a key with all the correct
answers. When I take the total number of answers right and divide them by
the total number of possible "correct" answers, I get a decimal. I need
to know how to take that decimal and make a percentage out of it?
This is what I have thus far:
<%
int answerright
int total
answerright = 28
total = 40
percentage = answerright/total
percentage = percentage & "%"
response.write percentage
%>
Any help would be appreciated!!
Thx,
Jeff
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
_________________________________________________________________
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material. Any review, retransmission,
dissemination or other use of, or taking of any action in reliance
upon, this information by persons or entities other than the
intended recipient is prohibited. If you received this in error,
please contact the sender and delete the material from any
computer.
Message #2 by Paul R Stearns <pauls@c...> on Fri, 28 Jun 2002 12:25:36 -0400
|
|
percentage = cStr(percentage * 100) & "%"
Jeff McFarland wrote:
> Hi,
>
> I am creating a math placement form. Once the user fills out the form,
> the answers are tabulated and compared to a key with all the correct
> answers. When I take the total number of answers right and divide them by
> the total number of possible "correct" answers, I get a decimal. I need
> to know how to take that decimal and make a percentage out of it?
>
> This is what I have thus far:
>
> <%
> int answerright
> int total
>
> answerright = 28
> total = 40
> percentage = answerright/total
> percentage = percentage & "%"
>
> response.write percentage
> %>
>
> Any help would be appreciated!!
>
> Thx,
>
> Jeff
>
> ---
>
> Improve your web design skills with these new books from Glasshaus.
>
> Usable Web Menus
> http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
> r-20
> Constructing Accessible Web Sites
> http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
> http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> r-20
Message #3 by "Jeff McFarland" <jeff@s...> on Fri, 28 Jun 2002 16:27:46
|
|
Hi,
I am creating a math placement form. Once the user fills out the form,
the answers are tabulated and compared to a key with all the correct
answers. When I take the total number of answers right and divide them by
the total number of possible "correct" answers, I get a decimal. I need
to know how to take that decimal and make a percentage out of it?
This is what I have thus far:
<%
int answerright
int total
answerright = 28
total = 40
percentage = answerright/total
percentage = percentage & "%"
response.write percentage
%>
Any help would be appreciated!!
Thx,
Jeff
Message #4 by "John P. Miller" <jpmiller@a...> on Fri, 28 Jun 2002 11:38:38 -0400
|
|
Could you just multiply by 100?
<%
int answerright
int total
answerright = 28
total = 40
percentage = answerright/total
percentage = percentage * 100
percentage = percentage & "%"
response.write percentage
%>
----- Original Message -----
From: "Jeff McFarland" <jeff@s...>
To: "ASP Web HowTo" <asp_web_howto@p...>
Sent: Friday, June 28, 2002 4:27 PM
Subject: [asp_web_howto] How to create a percentage using ASP?
> Hi,
>
> I am creating a math placement form. Once the user fills out the form,
> the answers are tabulated and compared to a key with all the correct
> answers. When I take the total number of answers right and divide them by
> the total number of possible "correct" answers, I get a decimal. I need
> to know how to take that decimal and make a percentage out of it?
>
> This is what I have thus far:
>
> <%
> int answerright
> int total
>
> answerright = 28
> total = 40
> percentage = answerright/total
> percentage = percentage & "%"
>
> response.write percentage
> %>
>
> Any help would be appreciated!!
>
> Thx,
>
> Jeff
>
> ---
>
> Improve your web design skills with these new books from Glasshaus.
>
> Usable Web Menus
> http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
> r-20
> Constructing Accessible Web Sites
> http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
> http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> r-20
|
|
 |