Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

infinite value total

	Scanner sc = new Scanner(System.in);
	int value = 0;
	int total = 0;

    //adds a number to the total variable every occurence of the loop
		
	for (;;) {
			
		System.out.println("Enter a number");
		value = sc.nextInt();
			
		total += value;
			
		System.out.println("You added " + value + " to the total");
		System.out.println("The total is " + total + " so far");
			
		value = 0;		
			
	}
Comment

PREVIOUS NEXT
Code Example
Java :: Describe Methods Overloading in Java 
Java :: android get user defined device name programmatically 
Java :: how to covert array into a char 
Java :: what are parameters in java 
Java :: Java display form 
Java :: java convert url/image to drawable 
Java :: java foreach method 
Java :: student information using array of object java 
Java :: display two dimensional array java 
Java :: model mapper to list stream 
Java :: java bogosort 
Java :: android java how to stop activity from opening twice programatically 
Java :: create an empty array in java 
Java :: for loop condition java 
Java :: Java Create a LinkedHashSet 
Java :: java change frame border 
Java :: spring cli version 
Java :: math.sin in java 
Java :: expression régulière téléphone java 
Java :: java empty array list vs null elements 
Java :: kotlin edittext default value 
Java :: Java TreeMap Example NavigableMap 
Java :: how to reverse numbers in java 
Java :: java continue statement 
Java :: java interview questions 
Java :: FlutterFirebaseCorePlugin.java uses or overrides a deprecated API. 
Java :: Java Access superclass attribute 
Java :: array index out of bound exception in java 
Java :: how to close scanner in java 
Java :: generate hash in java 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =