Advertisement
LightProgrammer000

Lei de Ohm

Jan 26th, 2019
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2.  
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4.  
  5.     <head>
  6.         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7.         <title> Testando JavaScript </title>
  8.  
  9.         <style> </style>
  10.  
  11.         <script type="text/javascript">
  12.        
  13.             // Funções
  14.             function Corrente(U, R)
  15.             {
  16.                 if (R == 0)
  17.                 {
  18.                     return 0;                  
  19.                 }
  20.                
  21.                 else
  22.                 {
  23.                     return (U/R);
  24.                 }
  25.             }
  26.  
  27.             var tensao = prompt("Digite o valor da tensão: ", 0);
  28.             var resistencia = prompt("Digite a resistência: ", 0);
  29.            
  30.             alert("Corrente: " + Corrente(tensao, resistencia) + " A");
  31.  
  32.         </script>
  33.     </head>
  34.  
  35. <body>
  36.  
  37. </body>
  38.  
  39. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement