Quantcast
Channel: Fórum ASP
Viewing all articles
Browse latest Browse all 1214

Problemas com respostas de um código para gerar média de somas

$
0
0

Caso algum de vocês puderem me ajudar, estou com problemas para desenvolver a Atividade, escolhi escrever um script para média de notas, porém ele está concatenando ao invés de somar, e a resposta é sempre "aluno reprovado"
Segue códigos:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>calculo_media</title>
</head>

<body>
<form id="form1" name="form1" method="post" action="response_media.asp">
<p><strong>Nome:</strong></p>
<label for="Nome"></label>
<input type="text" name="Nome" id="Nome" />
<p>Nota do primeiro bimestre:
<label for="n1"></label>
<input type="text" name="n1" id="n1" /></p>
<p>Nota do segundo bimestre:
<label for="n2"></label>
<input type="text" name="n2" id="n2" /></p>
<p>Nota do terceiro bimestre: 
<label for="n3"></label>
<input type="text" name="n3" id="n3" /></p>
<p>
<input type="submit" name="enviar" id="enviar" value="Enviar" />
<input type="reset" name="limpar" id="limpar" value="Limpar" /> </p>
</form>
<p> </p>

</body>
</html>



<% Option Explicit %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>response_calculo_media</title>
<%
Dim a,b,c,d,nota
a=Request.Form("n1")
b=Request.Form("n2")
c=Request.Form("n3")
d=(a+b+c)
nota= d/3
%>

<%
if nota < 5 then 'comparação entre dois valores
response.write ("A nota foi " & nota &": aluno reprovado!")'
'

else

if nota > 5 then 'comparação entre dois valores
response.write ("A nota foi " & nota &": aluno reprovado!")'
'
end if
end if
%>

</head>
<body>
</body>
</html>


Viewing all articles
Browse latest Browse all 1214