Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

add infinite values 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 :: exceptions in java 
Java :: linked list vs array list vs vector 
Java :: how to create a console in java gui 
Java :: java get year difference between two dates 
Java :: afficher matrice java 
Java :: string to char 
Java :: dont kill service in android studio 
Java :: Java Add Elements to an ArrayList 
Java :: potenzieren java 
Java :: horizontal recyclerview item width half of screen android 
Java :: object type in java 
Java :: java foreach letter in word 
Java :: treeset java descending order using comparator 
Java :: java empty arraylist 
Java :: java.lang.SecurityException: Permission Denial: reading androidx.core.content.FileProvider 
Java :: java inner method 
Java :: android list tostring 
Java :: Error inflating class android.support.design.widget.CoordinatorLayout 
Java :: Bukkit plugin player variable 
Java :: android send fragment context 
Java :: how to find odd and even in a array 
Java :: null java 
Java :: sharedpreferences 
Java :: multiple spinner android 
Java :: how to find a word in a statement java 
Java :: Java long Keyword 
Java :: mongorepository spring boot custom query 
Java :: syntax of the switch statement in Java 
Java :: The Longest Substring 
Java :: positive numbers in array 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =