What is coding to count no.of +ve and -ve no. entered by user like user will enter different numbers in prompt box,0 to stop. | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

What is coding to count no.of +ve and -ve no. entered by user like user will enter different numbers in prompt box,0 to stop.

JAVASCRIPT

28th Jan 2018, 12:54 AM
Manpreet Singh
Manpreet Singh - avatar
35 Respuestas
+ 4
yes. it will be fine
28th Jan 2018, 5:59 AM
jay
jay - avatar
+ 7
Can you try explaining your request in another way, I do not understand what you mean
28th Jan 2018, 1:55 AM
jay
jay - avatar
+ 7
give me a bit to type an example. I am out at the shops at the moment. But now that you have explained it better, some one should be able to help you
28th Jan 2018, 2:01 AM
jay
jay - avatar
+ 7
This may help you. https://www.w3schools.com/js/js_popup.asp You will want to use a prompt box to get user input inside a loop which checks the user input upon each iteration. If user input equal 0 exit loop else Use an alert box to display user input
28th Jan 2018, 2:08 AM
jay
jay - avatar
+ 7
;) Sorry I got confused, I thought you just wanted an idea of how to do it.
28th Jan 2018, 2:13 AM
jay
jay - avatar
+ 7
give me a bit and I will create a code to show how to do it with input boxes and loops
28th Jan 2018, 2:14 AM
jay
jay - avatar
+ 6
? It tells you how to create input prompts and alert prompts
28th Jan 2018, 2:13 AM
jay
jay - avatar
+ 6
it does, until user enters a 0, it will keep on asking. This should be enough for you to get a start. Adding and subtracting entered values should be a simple matter from here
28th Jan 2018, 2:32 AM
jay
jay - avatar
+ 5
oh.
28th Jan 2018, 1:58 AM
jay
jay - avatar
+ 5
ohh, well that should be an easy task now too, just include an if statement inside the loop to check whether user is negative or positive
28th Jan 2018, 2:38 AM
jay
jay - avatar
28th Jan 2018, 2:41 AM
jay
jay - avatar
+ 5
you're welcome! did you need me to explain how to works?
28th Jan 2018, 2:44 AM
jay
jay - avatar
+ 5
anytime!
28th Jan 2018, 2:46 AM
jay
jay - avatar
+ 5
I would prefer you do not as I am only one person, and only have so much knowledge. You are much better to ask here so many eyes can see it. More eyes equal more brains and a better quality answer.
28th Jan 2018, 2:51 AM
jay
jay - avatar
+ 5
because we check inputs value straight after we declare the variable. we could just use var input; and it would still work fine (when first checked inputs value would be null) but I am a little pedantic
28th Jan 2018, 4:52 AM
jay
jay - avatar
+ 2
after entering different values when user enter 0 then a message will appears you have entered .. positive and ... negative numbers
28th Jan 2018, 1:58 AM
Manpreet Singh
Manpreet Singh - avatar
+ 2
I am confused how to do this
28th Jan 2018, 1:59 AM
Manpreet Singh
Manpreet Singh - avatar
+ 2
just give me any idea
28th Jan 2018, 2:01 AM
Manpreet Singh
Manpreet Singh - avatar
+ 2
no it should keep record of each value and keep on showing prompt box untill user enter zero.When user enter 0 then will show that "you have entered n positive and z negative numbers
28th Jan 2018, 2:35 AM
Manpreet Singh
Manpreet Singh - avatar