Ticker

6/recent/ticker-posts

Javascript program to find sum of two number


problem:- To find the sum of two number using javascript.

  • First open notepad as editor.
  • write code using html and javascript web developement language.
  • save file filename.html(html is extention for web file).
  • Then   right click on file and open with internet explorer(browser).
  • Browser show output according to the coding.
Html and javascript Code 


Output





In javascript coding use prompt box to get input from the user at run time.  paresInt function used to convert string into integer value. Because javascript is loosly type language. document.writeln function is used to print a message on browser screen in javascript. Using these function print the value of sum .<script> tag is used to embedded javascript with html. In javascript var keyword is used to declare variable.In this program use five variable(n1,n2,num1,num2,sum).








 



Post a Comment

0 Comments