Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

add infinite numbers to variable java

	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 :: Java Create a BufferedInputStream 
Java :: could not find java in a java_home at /opt/java/openjdk/bin/java docker sonarqube 
Java :: integer parse int exceptions 
Java :: locked screen android studio 
Java :: linked list vs array list vs vector 
Java :: Java display form 
Java :: rename action bar android 
Java :: how to run a java file in terminal 
Java :: bulkwrite mongodb array of objects 
Java :: boolean 
Java :: convert jwt claim to string java 
Java :: jackson deserialization fail-on-unknown-properties true 
Java :: java foreach letter in word 
Java :: java gmt zoneid 
Java :: how to translate java swing 
Java :: arc() method from the processing library 
Java :: java regex for ip address 
Java :: react-native force light mode 
Java :: difference between linkedlist and arraylist 
Java :: exception in java 
Java :: indexof list java 
Java :: GetMapping("/rest/v1/books") in spring rest api 
Java :: java take and save screenshot 
Java :: stringbuilder with delimiter java 
Java :: sort java array 
Java :: Java peek() Method 
Java :: java check prime number 
Java :: what is stringbuilder used for in java 
Java :: Java Nested and Inner Class 
Java :: what is jar file in java 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =