Solved

sum of 5 number using Java script

Posted on 2009-05-19
6
358 Views
Last Modified: 2013-11-05
Hi,
I want java scriopt program to enter 5 value
and print in screen again and with sum of this 5 munber


like this will appear
2
3
4
2
7
sum=18
0
Comment
Question by:miziri
  • 3
  • 2
6 Comments
 
LVL 5

Expert Comment

by:satheeshm
ID: 24421181
Hi,

Try this code

<script type="text/javascript">
<!--

var i1 = prompt ("Enter Input Value 1 ?","2");
var i2 = prompt ("Enter Input Value 2 ?","3");
var i3 = prompt ("Enter Input Value 3 ?","4");
var i4 = prompt ("Enter Input Value 4 ?","2");
var i5 = prompt ("Enter Input Value 5 ?","7");

alert ("Sum of Input Values is : " + (parseInt(i1)+parseInt(i2)+parseInt(i3)+parseInt(i4)+parseInt(i5)));
document.writeln("Sum of Input Values is : " + (parseInt(i1)+parseInt(i2)+parseInt(i3)+parseInt(i4)+parseInt(i5)));

// -->
</script>
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24421192
Homework, much?
0
 

Author Comment

by:miziri
ID: 24428728
Hi satheeshm:,
I want all value enter on one prompt only:
var i1 = prompt ("Enter Input Value 1 ?","23427");

thanks
0
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24428807
If this is homework, please do some of your own investigation.
You want the String split function to split the result
0
 

Author Comment

by:miziri
ID: 24429297
Hi mplungjan:
Friend do have specail link which i can find many example
real difficult with java with notepad not complier to know error location\

thx
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 50 total points
ID: 24429330
Not at all.
Download firefox 3 and open the error console

http://w3schools.com/js/default.asp
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction:   Welcome to my first article ever. To begin with, the reason I write this article.  I participated in a question on Experts Exchange about the start command in Windows and there were some discussion about the usage. The discussio…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question