Please share a way of counting the user input without asking the user to tell the input count and without using methods of Scanner, math or any predefined classes...? I need to understand the logic implemented to count the no. of user input.
Please share a way of counting the user input without asking the user to tell the input count and without using methods of Scanner, math or any predefined classes...? I need to understand the logic implimented to count the no. of user input.
Under discussion
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
ThomasLC
31 May 2019, 05:24
Create a count variable and increase it by 1 everytime you read in an integer
0
Sudhansu Shekhar
31 May 2019, 15:27
Hi Thomas,
Concept of count variable worked. Now if i need to get input from the user and find sum of the input then how should we proceed.
Constraints are :
+> We cannot ask user regarding the no. of values he's going to enter.
+> We can just take user input of the numbers for which we need to find Arithmetic mean. User can input 10 numbers or 20 numbers or whatever he feels suitable. We need to get input from user and then output him with the required Arithmetic mean.
+> User will enter the numbers and we need to give him the arithmetic mean.
Please suggest some logic according to the situation described above.
Thanks for time.
0