Advertisement
LightProgrammer000

Operação Matemáticas [Básicas]

Jan 25th, 2019
305
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.             // Variáveis
  14.             num1 = prompt("Digite N1: ", 0);
  15.             num2 = prompt("Digite N2: ", 0);
  16.  
  17.             // Conversão
  18.             n1 = parseFloat(num1);
  19.             n2 = parseFloat(num2);
  20.  
  21.             // Operações
  22.             soma = n1 + n2;
  23.             subtracao = n1 - n2;
  24.             multiplicacao = n1 * n2;
  25.             divisao = n1 / n2;
  26.             modulo = n1 % n2;
  27.  
  28.             // Saída de dados
  29.             document.write("<br> # Soma: " + soma );
  30.             document.write("<br> # Subtração: " + subtracao );
  31.             document.write("<br> # Multiplicação: " + multiplicacao );
  32.             document.write("<br> # Divisão: " + divisao );
  33.             document.write("<br> # Resto: " + modulo );
  34.             document.write("<br> # Pré-Incremento: " + ++n1 );
  35.             document.write("<br> # Pós-Decremento: " + --n2 );
  36.            
  37.         </script>        
  38.     </head>
  39.  
  40. <body>
  41.  
  42. </body>
  43.  
  44. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement