Solved

sum of 5 number using Java script

Posted on 2009-05-19
6
350 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now