Fredin

Untitled

Jan 30th, 2012
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. document.writeln("Exercise 3.1");
  2. document.writeln("<hr>");
  3.  
  4. var tal1;
  5. var tal2;
  6.  
  7. function numberInput()
  8. {
  9.     tal1 = prompt("Wilkommen till kalkylatorn", "Skriv tal 1");
  10.     tal2 = prompt("Wilkommen till kalkylatorn", "Skriv tal 2");
  11. }
  12.  
  13. function addition()
  14. {
  15.     var additionResult;
  16.     additionResult = parseInt(tal1) + parseInt(tal2);
  17.     return additionResult;
  18. }
  19.  
  20. function multiply()
  21. {
  22.     var multipliedResult;
  23.     multipliedResult = parseInt(tal1) * parseInt(tal2);
  24.     return multipliedResult;
  25. }
  26.  
  27. function subtract()
  28. {
  29.     var subtractedResult;
  30.     subtractedResult = parseInt(tal1) - parseInt(tal2);
  31.     return subtractedResult;
  32. }
  33.  
  34. function division()
  35. {
  36.     var dividedResult;
  37.     dividedResult = parseInt(tal1) / parseInt(tal2);
  38.     return dividedResult;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment